Skip to content

Commit b87dc44

Browse files
authored
Update README.md
1 parent cbe5400 commit b87dc44

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,27 @@ import React, { Component } from 'react';
353353

354354
class Button extends Component {
355355

356+
state = {
357+
358+
results: []
359+
}
360+
361+
356362
callApi = async() => {
357363

358364
const api_call = await fetch('http://localhost:3000/api/v1/movies');
359365

360366
const data = await api_call.json();
361367

362-
console.log(data);
368+
this.setState({
369+
370+
results: data
371+
});
363372
}
364373

365374

366375
render() {
376+
367377
return (
368378
<div>
369379
<div className="card container mt-3">
@@ -372,6 +382,7 @@ class Button extends Component {
372382
<center>
373383
<button className="btn btn-primary" onClick={this.callApi}>Test Call!</button>
374384
</center>
385+
{this.state.results.map((obj) => <li>{obj.name}</li>)}
375386
</div>
376387
</div>
377388
</div>
@@ -382,6 +393,7 @@ class Button extends Component {
382393

383394
export default Button;
384395

396+
385397
```
386398

387399

@@ -390,3 +402,7 @@ export default Button;
390402
"proxy": "http://127.0.0.1:3000",
391403

392404

405+
406+
IN PROGRESS
407+
408+

0 commit comments

Comments
 (0)