Skip to content

Instantly share code, notes, and snippets.

@lithin
Last active July 12, 2016 10:22
Show Gist options
  • Save lithin/5a20e5333bbc7f56914384968af117c9 to your computer and use it in GitHub Desktop.
Save lithin/5a20e5333bbc7f56914384968af117c9 to your computer and use it in GitHub Desktop.
import { hashMap, merge } from 'mori';
import { USER_LOADED } from './actions';
// note that our default state is an empty hashMap - but it can be initialised into any hashMap
export default function userReducer(state = hashMap(), action) {
switch (action.type) {
case USER_LOADED:
return merge(state, action.user);
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment