Skip to content

I think my thinking might be broken on a single subject

twitter logo github logo ・1 min read  

Hello, hello, hello!
I am trying to start to combine React (which I kind of learned how it works) with Node, MongoDB and Express. Kind of a MERN stack. My question is... how? How can I get the front-end React to work hand-in-hand with the back-end Node? A step by step guide would be perfect, or at least what should I search for. I spent all my day onto this, I found starterKits for React, but I can't figure out how to do it. Thanks a lot, in advance!

twitter logo DISCUSS (2)
markdown guide

Are you planning on using Node and Express to build an API?

My suggestion would be to make these two separate projects if this is the case. Your Node API would then get deployed to a server, and you would use JavaScript requests within React to talk to your API.

There are many ways to approach this problem, but that would be my suggestion - separation of concerns.


React is a View
Node/Mongo/Express are the back end

You have some gaps in your architecture.

Client - must fetch data from the server (API client)
Client - must store data to a model/store
Client - must manage the navigation (each URL === 1 or more react components)
Client - optional - manage your state mutations, make only 1 source of truth with something like RXJS or Redux

A nice intro to MVC and react here

The big frameworks like Angular has all of this incorporated.

Classic DEV Post from Mar 20

What was your win this week?

Got to all your meetings on time? Started a new project? Fixed a tricky bug?

Alin Pisica profile image
Full Stack developer @Equilobe

Hey there reader...

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️