When do you need to use redux?

redux usage scenario, teacher Ruan Yifeng"s blog from a single source

scenarios where redux is required:
  • users use complicated ways
  • users with different identities have different ways of using them (such as ordinary users and administrators)
  • multiple users can collaborate
  • interacts heavily with the server, or uses WebSocket
  • View needs to obtain data from multiple sources

question:
1. What do you mean by "View getting data from a single source" and "getting data from multiple sources" mentioned above?
2. If you use react to write a separate blog with front and back end, which involves registration, login, and the addition, deletion, modification and query of articles, do you need redux for this scenario?

Sep.16,2021

Redux is used to manage the state uniformly. The project is relatively complex, and many global variables are needed. If there are more cross-component operations, it needs

.

if the pages are not very complex and the pages are relatively independent, it is not necessary to use Redux

.

ordinary blogs are not too complicated, so there is no need to use these

if it is a react project, you can replace Redux with the new context API. After all, it comes with it, and you can also implement global state management

.
  1. roughly means that redux can be divided into modules.

for example, each page is a module stored in redux, if one page needs to use the data of another page. The other page is not easy to put globally.
this kind of situation is more common in your project, so you can consider redux.

  1. Registration, login, additions, deletions and changes of article entities I don't think it's necessary to redux.

You Might Not Need Redux

Menu