Basic use of redux

realize the function of adding and subtracting numbers by clicking buttons through redux.
it doesn"t work according to other demo. I don"t know what the problem is.
Please explain
paste the code

below.
Mar.02,2021

you can't see anything wrong with the code you posted.
you should follow the official example, step by step.

We generally treat state as a tree rather than a number.


are you not doing status monitoring? Subscribe is used to subscribe to changes in store. For example, every time you dispatch (action) store, it triggers the function call registered by subscribe

.

store.subscribe ()

The details of

are not very clear, but store.getState () should be used in the callback of store.subscribe () , so that you can see the changes. In addition, it is recommended that you read it according to official Chinese document , because redux can be directly used on React (after all, it has nothing to do with the framework). However, it is recommended that react's state be managed by redux through react-redux.

Menu