Last active
October 9, 2018 14:00
-
-
Save danhollick/87ece0952f677a579eca26d18eaa0f89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends Component { | |
state = { images: [ | |
{ name: '', url:'' } | |
]} | |
componentDidMount() {//1 | |
fetch('/frames')//2 | |
.then(res => res.json())//3 | |
.then(data => this.setState({ images: data }))//4 | |
.catch(error => console.log(error)); | |
} | |
render() { | |
return ( | |
<div className="App" }> | |
{this.state.images.map( | |
(frame,i) => | |
<div key={i} > | |
<img src={frame.url} alt={"figma component"}/> | |
<p>{frame.name}</p> | |
</div> | |
)} | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment