So I'm very confused about React and need some clarification


#1

So I’ve been learning React and from what I can tell it’s NOT a backend framework and am not sure how to get data from the backend and take to the frontend.

From React’s Website
"Create React App doesn’t handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. It uses build tools like Babel and webpack under the hood, but works with zero configuration."

Possible Solution:
Create a frontend app using the React Framework (it’ll be static from what I understand) then make some other backend and pull data with jquery that’s in JSON framework. Although that will quickly turn into a very complex project.

Now the question:
Can React be configured to handle the backend logic and databases OR will I have to create a separate backend application that the React Application connects to with the solution above.


#2

You’re absolutely right for most of this. React falls into the V of the MVC pattern. More appropriately, I think it falls into a category called MVVM. With certain things like Redux or Firebase, you can handle a lot of the other parts without needing much of a “server”. But it isn’t designed to manipulate the back-end directly.

A very common pattern that I’m seeing is projects that have back-end, front-end, and shared code/logic. Meteor works this way.

A nice benefit to this pattern is that your back-end logic can be called from anywhere. You could be on a team that develops a web, native mobile, and other front-ends that all call the same back-end.

But you might not need all that. To answer your question directly: React can call out to databases (Firebase being the most popular thanks to it’s authentication systems) and APIs, but I wouldn’t try to force it to handle back-end logic directly.


#3

Do you have any good resources for using React and setting up a separate backend and how to put it altogether?


#4

I don’t, unfortunately. :frowning:

I became familiar with the pattern while working through Andrew Mead’s Meteor+React course on Udemy (which I really liked… so maybe I do have a good resource).

I know Andrew is currently updating his React course right now too. I think he’s trying to launch in early August. His old React course was also excellent… as well as his Node Developer course.