State fundamentals: local, shared, service, RxJS and Signals state
Learn State fundamentals: local, shared, service, RxJS and Signals state (Module 15 · State Management, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is state? • State is the data that decides what the screen shows: the logged-in user, items in the cart, whether a menu is open. State management is deciding where that data lives and how it changes. • Local component state : used by one component only (is the dropdown open?). Keep it in the component as a signal. • Shared application state : needed by several components (cart, user). Put it in a service that components inject (like a Spring singleton bean). • Rule: keep state as local as possible and share only what must be shared.
More lessons in Module 15 · State Management
- Module 15 overview and checklist
- Immutable updates, normalization, derived, loading and error state
- Authentication state, persisting state and browser storage
- NgRx fundamentals: Store, actions, reducers, selectors
- NgRx effects, entities, feature state and DevTools
- NgRx Signal Store
- State management testing and choosing an approach