Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't React considered MVC?

Tags:

I know that ReactJS isn't considered MVC, because the creators themselves have said so. But, recently, I was asked WHY React it isn't considered MVC even though it fits the MVC pattern. React renders a view, and when the someone using the client makes changes, React will take into account the change, update a state if needed (and isn't state just the model?), then return the updated view (just like a controller would). I have a very basic understanding of the strict definitions of MVC architecture, and am extremely confused by why React isn't MVC now.

like image 247
albert Avatar asked Dec 11 '18 17:12

albert


1 Answers

React is neither MVC or notMVC. It's a library to render the View (with a lots of cool stuff, but still). You can use either MVC patterns, or Flux/Redux, or whatever.

The difference between MVC and Flux is that latest implements unidirectional data flow. So your data can move only one direction. Action -> Middleware -> Store -> View. MVC is bidirectional; you can change Model from View and from Controller.

like image 88
Dima Vishnyakov Avatar answered Nov 24 '22 22:11

Dima Vishnyakov