http://andrewhfarmer.com/react-ajax-best-practices/
https://daveceddia.com/ajax-requests-in-react/
Excerpt:
One of the first questions new React developers have is, “How do I do AJAX requests in React?”Here’s an answer to that question.
First: React itself doesn’t have any allegiance to any particular way of fetching data. In fact, as far as React is concerned, it doesn’t even know there’s a “server” in the picture at all.React simply renders components, using data from only two places: props and state.
So therefore, to use some data from the server, you need to get that data into your components’ props or state.
You can complicate this process with services and data models (er, “build abstractions”) as much as you desire, but ultimately it’s just components rendering props and state.
No comments:
Post a Comment