Answer the question
In order to leave comments, you need to log in
Do I need to use MV* patterns in React apps?
Hello. I'm doing projects for a portfolio for an interview, so it's interesting to what extent on the web, and specifically in conjunction with React, you need to follow architectural patterns. And is it necessary at all? The question is mostly asked because I have a general idea about them, but I don’t quite understand how to CORRECTLY implement this on React applications. Take, for example, MVC.
As far as I understand, views are child (relative to the root component) components that implement the render method and, possibly, some extremely simple state (the value of the input, for example).
If we imagine that Redux is overkill for our project, what then acts as a model? The state of the root element, from which data is passed through props to child components? Then it turns out that the root component describes both M and V. And then what is the controller?
Of course, we are not talking about landing pages and not about sites in general, but about applications - instant messengers, simple graphic editors, etc. I will also be happy to provide links to repositories / sites with best practices for using architectural patterns.
Answer the question
In order to leave comments, you need to log in
If there is a lot of redux (I can’t imagine where this could be), then it’s better to skip not in props, but use the Context API https://uk.reactjs.org/docs/context.html
In general, there are so many different state managers
https://mobx. js.org/README.html
https://mobx-state-tree.js.org/intro/philosophy
https://recoiljs.org/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question