Last active
April 25, 2020 14:06
-
-
Save Manntrix/82bc0284fd2bd144044412a655b87717 to your computer and use it in GitHub Desktop.
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
receivedData() { | |
axios | |
.get(`https://jsonplaceholder.typicode.com/photos`) | |
.then(res => { | |
const data = res.data; | |
const slice = data.slice(this.state.offset, this.state.offset + this.state.perPage) | |
const postData = slice.map(pd => <React.Fragment> | |
<p>{pd.title}</p> | |
<img src={pd.thumbnailUrl} alt=""/> | |
</React.Fragment>) | |
this.setState({ | |
pageCount: Math.ceil(data.length / this.state.perPage), | |
postData | |
}) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment