Skip to content

Instantly share code, notes, and snippets.

@rubenmarcus
Created April 18, 2020 10:52
Show Gist options
  • Save rubenmarcus/5e33d05f81c1c7f668d3eba8e302ace4 to your computer and use it in GitHub Desktop.
Save rubenmarcus/5e33d05f81c1c7f668d3eba8e302ace4 to your computer and use it in GitHub Desktop.
const reducer = (state, action) => {
switch (action.type) {
case FETCH_DATA: {
return {
...state,
isFetching: true
}
}
case FETCH_DATA_SUCCESS: {
return {
...state,
isFetching: false,
data: action.payload
}
}
default: {
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment