DEV Community

Discussion on: Roadmap for React JS 2022

Collapse
 
digvijayjadhav98 profile image
Digvijay Jadhav

MVC and MVT are design patterns, we use them for better structuring of code. To your question, large companies rarely have a consistent codebase throughout, so they use multiple frameworks as per the use case. If you want to use any other framework along with React then what's the use case? What are you trying to achieve by doing this?

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

Next JS is a framework that works with React and provide server side rendering.

Of course you can code it by yourself with laravel or plain php or whatever server side language of your choice instead.

Thread Thread
 
roshanp98 profile image
RoshanP98 • Edited

That's what I want to know, why react is considered when we build project on MVC design pattern based framework ? server side rendering is already been fulfilled right ?, then why react ?

Thread Thread
 
digvijayjadhav98 profile image
Digvijay Jadhav

Ohh okay, got your point. So we have server side frameworks like NodeJs, Django, Flask where you can render UI templates along with API and can build entire website in backend. But reason why these Frontend framework come into picture because DOM manipulation, state management and reusable components are hard to handle when you don't have seperate frontend library. Basically your answer lies in the advantages of any of frontend library (React/Angular/Vue/Next)
Also from computational point of view, it's recommended to host backend and frontend seperately to distribute traffic equally.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

You don't use React in a MVC design pattern, simply because your server is not providing your view to the browser but "data" (usually in JSON format) that React (in this example) in the frontend will parse and handle to generate the actual views.
When you use Server Side Rendering (SSR) or Static Site Generation (SSG) then it's kinda sort of MVC (it will depend on the abstraction layers behind and the architecture).
If you use a Next JS which acts as a Backend, interacting with a Database and providing the view to pre-render it then yes, it's a MVC that it's hydrated afterwards with the reactive functionalities.
If you use a Next as middleware to handle that then usually it's not a MVC, you just have your services or microservices (in the language of your election, being laravel, lumen, Java Spring, Python, Node... whatever) that provide data to Next JS (next is fetching it) then you can have a MVVM for example...

When you split the backend and the frontend using microservices (and/or microfrontend) then the """integration""" is not like adding code inside code, it's about a piece of code providing code to another piece of code.