🌐State Management
Also known as Global State, App State Management, State Store
How an app keeps shared data the same in each part of the screen, like the cart.
Think of it like
It is like one class board. All read the same notes, and one change reaches all.
Example
Emma's shop shows the cart count in the header and the cart on the checkout page. Both read one store, so they always match.
Why it matters
Bugs where two parts of a screen disagree come from state kept in two places. One source of truth stops them.
Definition
Common mistake
Key takeaways
- 1One source of truth. Shared data lives in one place.
- 2Read and react. Parts update when the store changes.
- 3Keep local local. Only shared data goes in the store.