Skip to content

Instantly share code, notes, and snippets.

@Manntrix
Created May 1, 2020 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manntrix/866773576f17d62bb5d7a1c33f0a2e48 to your computer and use it in GitHub Desktop.
Save Manntrix/866773576f17d62bb5d7a1c33f0a2e48 to your computer and use it in GitHub Desktop.
app.js
constructor(props, context) {
super(props, context);
this.state = {
galleryItems: [],
};
}
getData (){
axios.get(`https://picsum.photos/v2/list?limit=6`, {})
.then(res => {
const data = res.data
const img = data.map(m =>
<img src={m.download_url} alt=""/>
)
this.setState({
galleryItems: img
})
}).catch((error) => {
console.log(error)
})
}
responsive = {
0: { items: 1 },
1024: { items: 2 },
}
componentDidMount() {
this.getData()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment