Skip to content

Instantly share code, notes, and snippets.

@reharik
Created May 17, 2016 20:30
Show Gist options
  • Save reharik/10cb998ac74b5d72aa8e2d54872c7954 to your computer and use it in GitHub Desktop.
Save reharik/10cb998ac74b5d72aa8e2d54872c7954 to your computer and use it in GitHub Desktop.
const reducers = combineReducers({
routing,
chapters: (state = {}) => state,
expandChapter
});
export default reducers;
const expandChapter = (state = {}, action = null) => {
if(action.type == EXPAND_CHAPTER) {
var item = state[action.id];
return {...item, isExpanded: !item.isExpanded}
}
return state;
};
export {
expandChapter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment