How to write a react state management framework?

as the title

in fact, there are two major problems that need to be solved:

1. Extract the data into store and monitor the data. You can use Object.defineProperties or Proxy

2. You need to notify the component to update

if the data changes.

if you want to achieve a good state management, how should you design it? How to update the corresponding components after the data has changed?

use react context , the 15.x version is not recommended, 16.x syntax changes too much, unstable things are not applicable as far as possible.

Please give me advice from the great gods

May.14,2021

I don't know why I wrote it myself

I think we can use off-the-shelf redux mobx

in addition, the Nuggets have several articles that rewrite status management
you can search

.
Menu