State Management - monello/complete-react-guide-2024 GitHub Wiki
The useState hook
- Basic use of the
useStatehook - Updating the UI based on a state-managed value and external data
- useState: updating a state-value when it is dependent on it's previous value
- Immutably updating complex state
Two-way binding
Lifting State
- Manage state in the nearest parent-component
- Another example/scenario for liftling state
- Prefer computed values and avoid unnecessary state management
Reducing State Management
Make sure you are not tracking state using useState(), when it is not necessarry
We ideally want to track as little as possible in State