Get
fetch("[API URL]", {
method: 'GET',
})
.then(res => res.json())
.then(json => {
this.setState({
result: this.state.result.concat(json)
});
});
Post
fetch("[API URL]", {
method: 'POST',
body: JSON.stringify({ param: param })
})
.then(res => res.json())
.then(json => {
this.setState({
result: this.state.result.concat(json.data)
});
});