Overview
- keeps the state of your app in a single store
- terms to learn: actions, reducers, action creators, dispatch, middleware, pure functions, immutability, selectors
- reducer’s job is to return a new state, even if that state is unchanged from the current one
- do not mutate the state. State is immutable
Sample reducer
1 | function reducer(state = initialState, action) { |
Terms and methods
connect
method
- Using the
connect
function that comes with Redux, you can plug any component into Redux’s data store, and the component can pull out the data it requires.
Example usage
1 | import React from 'react'; |