State Management · Junior · Question 13 of 75
Why name actions after what happened ('task_added') rather than what to do ('set_tasks')?
- ✓Correct answer: Handlers stay simple and the logic of how state changes lives in the reducer
- 2React requires action types to be in the past tense
- 3Past-tense names make the reducer run faster
Explanation
An action describes a user event ("a task was added"), and the reducer decides how state reacts. set_* actions push the logic back into components and turn the reducer into a dumb setter. The same convention is used in Redux.