Skip to content

Instantly share code, notes, and snippets.

@maximgatilin
Last active August 8, 2018 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximgatilin/b0d4e955b522620910eb0a489bbdcdd5 to your computer and use it in GitHub Desktop.
Save maximgatilin/b0d4e955b522620910eb0a489bbdcdd5 to your computer and use it in GitHub Desktop.
Bad reducer
import {LOCATION_CHANGE} from 'react-router-redux';
const initialState = {
timeFilter: '1M'
};
export const exampleReducer = (state = initialState, action) => {
switch (action.type) {
case LOCATION_CHANGE:
return {
...state,
timeFilter: action.payload.query.date || initialState.timeFilter,
}
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment