Reducers

Data-caching tier for Lore

Extending & Overriding Reducers

Given a project where a custom tweet.count reducer has been declared like so:

src
|-reducers
  |-tweet
    |-count.js

This hook will find it and expose it on lore.reducers.tweet.count and make sure it's combined into the Redux store.

Reducers should follow this format:

// file: src/reducers/tweet/count.js

module.exports = function count(state, action) {
  state = state || 0;

  switch (action.type) {
    case ActionTypes.ADD_TWEET:
      return state + 1;

    default:
      return nextState
  }
};