- Redux apps always have a single store
- Stores are created with the Redux
createStore
API - Every store has a single root reducer function
- Stores are created with the Redux
- Stores have three main methods
getState
returns the current statedispatch
sends an action to the reducer to update the statesubscribe
takes a listener callback that runs each time an action is dispatched
- Store enhancers let us customize the store when it’s created
- Enhancers wrap the store and can override its methods
createStore
accepts one enhancer as an argument- Multiple enhancers can be merged together using the
compose
API
- Middleware are the main way to customize the store
- Middleware are added using the
applyMiddleware
enhancer - Middleware are written as three nested functions inside each other
- Middleware run each time an action is dispatched
- Middleware can have side effects inside
- Middleware are added using the
- The Redux DevTools let you see what’s changed in your app over time
- The DevTools Extension can be installed in your browser
- The store needs the DevTools enhancer added, using
composeWithDevTools
- The DevTools show dispatched actions and changes in state over time
References
https://redux.js.org/tutorials/fundamentals/part-4-store