mercredi 25 juillet 2018

What's the best way to deal with fetching data from server in ReactJS

I'm working on a project using ReactJS in which I need to fetch data from my server. I request to the server using fetch in ComponentDidMount. To make sure the component renders properly, I use a flag ready in state which is assign to false at first. I update its value to true after server response.

I want to know if it's a good way. If you know a better way, please tell me. Thank you :D




Aucun commentaire:

Enregistrer un commentaire