Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Is react the mvvm framework?

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "react is the mvvm framework", the content is detailed, the steps are clear, and the details are handled properly. I hope this "react is the mvvm framework" article can help you solve your doubts.

React is not a mvvm framework. The mvvm framework needs a vm object to map the view, that is, when the properties of the vm object change, the corresponding view part will be updated accordingly; while there is no vm object in the react, there are plenty of properties and states, and the whole can be used as a View, so react is not a mvvm framework.

The operating environment of this tutorial: Windows10 system, react17.0.1 version, Dell G3 computer.

Is react the mvvm architecture?

React is not a mvvm framework

First of all, figure out what mvvm means. Vm means view mode.

So the mvvm framework needs to have a vm object to map the view. That is, when the properties of the vm object change, the corresponding view part will be updated accordingly.

More classic is knockoutjs, in which the key concept is the view model,compute,view template and so on. Yes, there is actually a lot of its shadow in vue.

Then take a look at react, which does not have a pure vm object, it is full of properties and states.

React can be the second V in MVVM, that is, View, but it is not the MVVM framework.

One of the most striking features of MVVM: two-way binding.

React does not have this, it is one-way data binding.

React is an one-way data flow library, state-driven view.

React as a whole is a functional idea, components are designed as pure components, state and logic are passed in through parameters, so in react, it is an one-way data flow, which is recommended to combine with immutable to achieve data immutability.

Then take a look at react, which does not have a pure vm object, it is full of properties and states. Map the view with properties and states. So what's the difference between attributes and states and vm? Personally, vm objects are treated equally in the end, regardless of whether your values are passed in from the outside or defined internally. In many cases, there is also a two-way binding mechanism, perhaps the early flex, it is amazing, the later mvvm framework has the concept of two-way binding. React, on the other hand, emphasizes the immutability of attributes and unidirectional data flow.

Internal state, internal self-control. Such a design may be more complex in terms of design, but it becomes more definite and clearer in terms of use. If react is familiar with, manage the appropriate state for the appropriate components, and make a reasonable layering of the state, the application complexity will be greatly reduced. Then, redux has a very advanced concept called container components and pure presentation components. If you understand this design idea and concentrate complex things into a small number of components, most components will become pure display components, further reducing application complexity.

Read this, the "react is mvvm framework" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report