Skip to content

Instantly share code, notes, and snippets.

@brakmic
Created March 14, 2017 14:56
Show Gist options
  • Save brakmic/6a30b18b9f89cd03d7b865ea061d60af to your computer and use it in GitHub Desktop.
Save brakmic/6a30b18b9f89cd03d7b865ea061d60af to your computer and use it in GitHub Desktop.
vr module reducer
const vrModuleReducer: ActionReducer<IVrModule[]> = (state: IVrModule[] =
initialState, action: Action) => {
switch (action.type) {
case VR_MODULE_REMOVED:
return _.filter(state, (mod) => mod.id === action.payload.id);
case VR_MODULE_ADDED:
return _.concat(state, action.payload);
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment