DEV Community

loading...

MVC architecture in react, node rest api

rumeshmadhusanka profile image Rumesh Madhusanka ・1 min read

I am creating a web app with react as front end, and a rest api as the back end. How does the MVC architecture fit in to it? OR is there a better architecture than MVC for this task?

Discussion (1)

pic
Editor guide
Collapse
sfiquet profile image
Sylvie Fiquet

You might want to have a look at this article by Michael Chan where he describes React as being the V and the C in MVC. But keep in mind that it was written 4 years ago and things have evolved since.

I got there from Dan Abramov's Medium post Smart and Dumb Components. Nowadays it starts with a warning that his views have evolved since he wrote it. Still it might be a starting point.

I wish I could point you directly to best practice but I'm still trying to figure out what that is. My general impression is that best practice is evolving with React and React is evolving as problems are identified and solutions are being provided. I believe the current recommendation these days is to use hooks to decouple behaviour from presentation.

Hooks were introduced earlier this year so they're a recent feature. If you are new to React maybe you want to get familiar with all the React concepts first before considering using hooks.