Redux
- What is redux?
- What is store?
- What is middleware?
- What is reducer and hi order reducer?
- Good pattern to update state on reducer
- What are the async actions?
- Normalizing state
- How to manage store?
What is store?
The Store is the object that brings them together. The store has the following responsibilities:
Holds application state;
Allows access to state via getState();
Allows state to be updated via dispatch(action);
Registers listeners via subscribe(listener);
Handles unregistering of listeners via the function returned by subscribe(listener).
What is the concept of “single source of truth” in Redux?
Having a single store enables using the Redux DevTools, makes persisting and rehydrating data simpler, and simplifies the subscription logic.
What is the role of reducers in Redux?
reducer is how the application's state changes in response
Things you should never do inside a reducer:
Mutate its arguments;
Perform side effects like API calls and routing transitions;
Call non-pure functions, e.g.
Date.now()
orMath.random()
Why is immutability required by Redux?
Time-travel debugging requires that reducers be pure functions with no side effects, so that you can correctly jump between different states.
Redux uses shallow equality checking in itscombineReducersfunction to return either a new mutated copy of the root state object, or, if no mutations have been made, the current root state object
https://github.com/rt2zz/redux-persist
https://github.com/gajus/redux-immutable
https://github.com/reactjs/reselect
https://github.com/mweststrate/immer
https://github.com/tommikaikkonen/redux-orm
https://github.com/manaflair/redux-batch
https://github.com/tappleby/redux-batched-subscribe
Redux
https://redux.js.org/api-reference
Redux Saga
Redux persist
https://github.com/rt2zz/redux-persist
normalizr