What are the advantages and disadvantages of React state management library React-thunk,React-redux,React-saga,dva?

what are the advantages and disadvantages of the React state management library React-thunk,React-redux,React-saga,dva?
do they have different usage scenarios or what?

Nov.09,2021

  1. dva is the framework that integrates react, redux, redux-saga, react-route
  2. redux-thunk, React-saga is redux middleware; thunk allows action to return functions; saga is complex, but handling asynchronous operations is simple.
  3. react-redux is the
  4. used to connect react and redux.

all kinds of so-called "frameworks" now learn from each other, and their design ideas will converge. At present, vue uses bidirectional binding, which is implemented by Object.defineProperty of es5.

clipboard.png

the figure above tells us that the b property under the an object defines getter and setter to hijack the property. When the property value changes, the notify notifies the watch object, while the watch object notify updates to the corresponding location on the view, and then we see the update of the view. In turn, when entering data in the view (such as input), it also triggers the subscriber watch,. Update the latest data to the data (A.B in the figure) so that the model data can respond to changes on the view in real time, such a process is the two-way binding of the data.

and react is a single binding. Only this, differences and ideas are different.


the above answers are all very accurate. Make a supplement:

  1. State management is the first step, which is not required for all projects. Native React can still develop well-designed front-end applications.
  2. if you really need state management, it is usually possible to develop projects that are relatively complex. Then for a relatively complex project, it is very important to consider the module decoupling of the project. Therefore, special attention should be paid to the use of state management. Incorrect use of state management may increase the coupling of the application. It is not conducive to the reasonable design of complex projects. The correct posture should be to understand the technical details of state management first. Then consider the modular design of the application. Then consider which kind of state management to use. Don't use state management just to share state.
  3. React's own context and hooks can effectively cope with most applications. Therefore, I personally do not recommend the use of state management at will. In particular, many of the frameworks or modules listed above have their own rules and characteristics, and the use of that may bring convenience as well as limitations.

in addition, I have used, redux, dva, umi, mobx personally, so it is recommended that general projects consider using mobx. Because mobx itself is not a framework, it has little impact on the structure of the code. Help to grasp the nature of React development step by step. Free use of the framework will take you away from the nature of React.

I'm going to do an advanced tutorial on React recently. Welcome to follow my lecture hall: my lecture hall

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32717-e363.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32717-e363.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?