Skip to content

Instantly share code, notes, and snippets.

@zackshapiro
Created June 14, 2019 23:16
Show Gist options
  • Save zackshapiro/3f4940f7414290be8bd23dd7f6df1b25 to your computer and use it in GitHub Desktop.
Save zackshapiro/3f4940f7414290be8bd23dd7f6df1b25 to your computer and use it in GitHub Desktop.
const reducer = (state, action) => {
switch (action.type) {
case 'load':
return { ...state, files: action.files, status: LOADED }
case 'submit':
return { ...state, uploading: true, pending: state.files, status: INIT }
case 'next':
return {
...state,
next: action.next,
status: PENDING,
}
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment