Affected files: .obsidian/workspace.json 2 Personal/1 Skills/IT/React Learnings.md
1.0 KiB
1.0 KiB
title, created_date, updated_date, aliases, tags
| title | created_date | updated_date | aliases | tags |
|---|---|---|---|---|
| React Learnings | 2025-05-17 | 2025-05-17 |
React Learnings
State Machine - Reducers
Reducers are what they are named after: they reduce the current state variable and an action/event into a new state and therefore are perfect for handling state machines of complex components within a react app. The official documentation is really good: useReducer – React and this blog article helped me as well: Medium
Reducers are pure, so within the reducer function you never do any API calls or anything that needs to do calculations.
If you need to do any API calls or heavy calculations they must be done outside of the reducer function as explained here: Just a moment....