State Management · Senior · Question 15 of 75
A reducer for orders/placed must also clear the cart slice. What's the idiomatic way?
- ✓Correct answer: Let the cart slice handle
orders/placedin itsextraReducers - 2Dispatch
cart/clearedfrom inside the orders reducer - 3Mutate the cart slice from the orders reducer via
getState()
Explanation
Reducers can't dispatch or touch other slices. Many reducers responding to one event is the intended Redux model: the action describes what happened, and each slice decides how to react.