Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Last active June 4, 2018 15:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvbattan/45dd3c2b3bc15892124bf87bd1da484a to your computer and use it in GitHub Desktop.
Save mvbattan/45dd3c2b3bc15892124bf87bd1da484a to your computer and use it in GitHub Desktop.
Reducer description
const reducerDescription = {
[actions.GET_MATCHES]: (state, action) => ({ ...state, matchesLoading: true }),
[actions.GET_MATCHES_SUCCESS]: (state, action) => ({
...state,
matchesLoading: false,
matchesError: null,
matches: action.payload
}),
[actions.GET_MATCHES_FAILURE]: (state, action) => ({
...state,
matchesLoading: false,
matchesError: action.payload
}),
[actions.GET_PITCHES]: (state, action) => ({ ...state, pitchesLoading: true }),
[actions.GET_PITCHES_SUCCESS]: (state, action) => ({
...state,
pitchesLoading: false,
pitchesError: null,
pitches: action.payload
}),
[actions.GET_PITCHES_FAILURE]: (state, action) => ({
...state,
pitchesLoading: false,
pitchesError: action.payload
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment