File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -353,17 +353,27 @@ import React, { Component } from 'react';
353
353
354
354
class Button extends Component {
355
355
356
+ state = {
357
+
358
+ results: []
359
+ }
360
+
361
+
356
362
callApi = async () => {
357
363
358
364
const api_call = await fetch (' http://localhost:3000/api/v1/movies' );
359
365
360
366
const data = await api_call .json ();
361
367
362
- console .log (data);
368
+ this .setState ({
369
+
370
+ results: data
371
+ });
363
372
}
364
373
365
374
366
375
render () {
376
+
367
377
return (
368
378
< div>
369
379
< div className= " card container mt-3" >
@@ -372,6 +382,7 @@ class Button extends Component {
372
382
< center>
373
383
< button className= " btn btn-primary" onClick= {this .callApi }> Test Call! < / button>
374
384
< / center>
385
+ {this .state .results .map ((obj ) => < li> {obj .name }< / li> )}
375
386
< / div>
376
387
< / div>
377
388
< / div>
@@ -382,6 +393,7 @@ class Button extends Component {
382
393
383
394
export default Button ;
384
395
396
+
385
397
```
386
398
387
399
@@ -390,3 +402,7 @@ export default Button;
390
402
"proxy": "http://127.0.0.1:3000 ",
391
403
392
404
405
+
406
+ IN PROGRESS
407
+
408
+
You can’t perform that action at this time.
0 commit comments