I'm trying to set a state from a fetch response, but it seems it takes a while to update the state.
What I learned is that fetch is quick until it comes to setState. There, it takes about 3 seconds to update.
fetch(ENDPOINT)
.then((response) => response.json())
.then((responseJson) => {
this.setState({product : responseJson.product, related: responseJson.related, ready: true});
})
.catch((error) => {
console.error(error);
}).done();
Any tips?
Thanks