React - keshavbaweja-git/guides GitHub Wiki

Redux Cycle

Action Creator -> Action -> dispatch -> Reducers -> state

Reducer

(State Version v, Action) => State Version v+1

const combinedReducers = combineReducers({
reducerKey1: reducer1,
reducerKey2: reducer2
});

const reduxStore = createStore(combinedReducers);

react-redux design

State-->Provider-->App-->Connect-->Component

Redux does not automatically detect action creators being called.

Rules of reducers -

  • must return any value other than 'undefined'
  • Pure functions; (state V, action V+1) = state V+1; no external calls
  • must not mutate input state argument, instead should return a new state object/array