Skip to the content.

Readings: Redux - Combined Reducers

While Redux itself is not opinionated about how your state is organized, combineReducers enforces several rules to help users avoid common errors.

1-Why choose Redux instead of the Context API for global state? Redux works around the idea of having a central state called a store. To change the state, a component has to dispatch an action. The action is then passed on to the reducer, which changes the state of our application, and we use redux in complex apps. 2-What is the purpose of a reducer? In Redux, a reducer is a pure function that takes an action and the previous state of the application and returns the new state. 3-What does an action contain? Actions are the only source of information for the store in redux and It carries a payload of information from your application to store. 4-Why do we need to copy the state in a reducer? redux only requires our reducers to stay pure. If the new state is different, the reducer must create new object, and making a copy is a way to describe the unchanged part. Document the following Vocabulary Terms immutable state: If an object is immutable, any changes that need to be made to it within a function must be made to a copy of the object.

time travel in redux: is the ability to move back and forth among the previous states of an application and view the results in real time.

image