Angular NgRx Flashcards
Managing states and interaction with that states
Managing states and interaction with that states
what is State
VIEW STATE = information about the view, whether to display specific fields or UI elements
USER INFORMATION = such as users name and role
that is used to tailor the application for the user
ENTITY DATA = such as product information that is displayed and manipulated by the application but originally retrieved from and stored on a back end server somewhere
USER SELECTION INPUT = current selected input or entered filtered string or any information data that application tracks
Purpose of NgRx
Provider formal pattern for managing application state into one single local state container
Managing the state by requiring one way data flow
Communicating state changes to our compnents, so they can react accordingly
Deciding on State Management.Do I need this data again, will I use it more than once?
State management is recycling your data. Will you need that value again in other parts of your application? Use state management. Do you only need to store the value temporarily and reference it in a specific component, only for it to be discarded shortly after that? Don’t use state management.
Asking yourself the following question should be the litmus test you apply to your development workflow. Will you need this value again and will you need it in other parts of your application? Type it up, print it out and hang it up on your wall.
The purpose of state management is not to play the role of “random kitchen drawer full of miscellaneous items”, it exists to make cross-component and cross-application data access easier as well as ensuring the integrity and shape of the data remains intact (in part due to Javascript passing everything by reference).