Last active
August 8, 2018 05:39
-
-
Save maximgatilin/b0d4e955b522620910eb0a489bbdcdd5 to your computer and use it in GitHub Desktop.
Bad reducer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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