AJAX Requests in React: How and Where to Fetch Data

Dave Ceddia. CodeProject. 2016-09-14.
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.

[AJAX Requests in React: How and Where to Fetch Data]

React: A JavaScript library for building user interfaces.

Why React?
React is a JavaScript library for creating user interfaces by Facebook and Instagram. Many people choose to think of React as the V in MVC.
They built React to solve one problem: building large applications with data that changes over time.

-Simple
Simply express how your app should look at any given point in time, and React will automatically manage all UI updates when your underlying data changes.
-Declarative
When the data changes, React conceptually hits the “refresh” button, and knows to only update the changed parts.
-Build Composable Components
React is all about building reusable components. In fact, with React the only thing you do is build components. Since they’re so encapsulated, components make code reuse, testing, and separation of concerns easy.
-Give It Five Minutes
React challenges a lot of conventional wisdom, and at first glance some of the ideas may seem crazy. Give it five minutes while reading this guide; those crazy ideas have worked for building thousands of components both inside and outside of Facebook and Instagram

[React: A JavaScript library for building user interfaces.]