Redux follows three basic principles:
- The whole state of the application is stored in a single immutable state tree called store. No state management is allowed outside the store. A central immutable store has a lot of benefits. You can improve the performance by using ChangeDetectionStrategy.OnPush because with immutable data, Angular only needs to check object references to detect changes. Furthermore, the undo/redo functionality is easy done.
- Actions are used to send information from the application to the store. Only actions are source of information for the store. Actions are plain JavaScript objects having type and payload properties. The type property describes a kind of state change we want. The payload property is the data being sent to the store in order to update it.
- State changes are made through pure functions called reducers. Pure functions are functions that don't mutate objects, but return brand new objects instead. We can grasp reducers as processing...