Home > Article > Web Front-end > When to use react-redux
Scenarios for using "react-redux": 1. When the user's usage method is complex; 2. When users with different identities have different usage methods; 3. When multiple users can collaborate; 4. When interacting with the server a lot, or using WebSocketView; 5. When data needs to be obtained from multiple sources.
The operating environment of this tutorial: Windows 10 system, react17.0.1 version, Dell G3 computer.
Scenarios where redux needs to be used:
The user’s usage is complex
Users with different identities have different usage methods (such as ordinary users and administrators)
Multiple users can Collaboration
Interacting heavily with the server, or using a WebSocketView
To get data from multiple sources
Scenarios where Redux is not required:
The user’s usage is very simple
No collaboration between users
No need for extensive interaction with the server, and no use of WebSocket
View layer (View) Only obtain data from a single source
Redux is used to manage status in a unified way. The project is relatively complex and requires many global variables. If there are many cross-component operations, it is necessary. The page is not very complex, and each page is relatively independent, so there is no need to use Redux. Generally, blogs are not too complicated, so there is no need to use these. If it is a react project, you can use the new contextAPI to replace Redux. After all, it comes with it, and you can also achieve global state management
Recommended learning: " react video tutorial》
The above is the detailed content of When to use react-redux. For more information, please follow other related articles on the PHP Chinese website!