Skip to content

Instantly share code, notes, and snippets.

@rohanBagchi
Last active February 26, 2018 07:22
Show Gist options
  • Select an option

  • Save rohanBagchi/1bcc4ffd77d0816d93a2c59eea74ecf5 to your computer and use it in GitHub Desktop.

Select an option

Save rohanBagchi/1bcc4ffd77d0816d93a2c59eea74ecf5 to your computer and use it in GitHub Desktop.
const defaultState = {
user: {}
};
export default function reducer(state, action) {
state = state || defaultState;
const { type, payload } = action;
switch (type) {
case 'SET_USER_DETAILS':
return {
...state,
user: payload.user
};
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment