Redux - Combined Reducers
Review, Research, and Discussion
-
Why choose Redux instead of the Context API for global state?
- Global state can get very large and complicated and the Context API is not effective handling this.
-
What is the purpose of a reducer?
- The reducer is used to prevent states are being mutated.
-
What does an action contain?
- An action contains type and payload. The type will tell the reducer what kind action it needs to perform, and the payload will pass the parameter to the reducer.
-
Why do we need to copy the state in a reducer?
- This will prevent the state is being mutated.
Document the following Vocabulary Terms
- immutable state: its value cannot be changed once it’s created
- time travel in redux: the process of logging actions and state during an app’s execution
- action creator: a function that literally creates an action object
- reducer: functions that take the current state and an action as arguments, and return a new state result
- dispatch: a function of the Redux store that will trigger a state change