Created
May 1, 2020 04:59
-
-
Save Manntrix/866773576f17d62bb5d7a1c33f0a2e48 to your computer and use it in GitHub Desktop.
app.js
This file contains 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
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