Created
July 12, 2016 20:13
-
-
Save ianjsikes/214495b7228aaee7e9c6ab8f50ec3f7c to your computer and use it in GitHub Desktop.
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
const initialState = { | |
index: 0, | |
routes: [ | |
{ key: 'a', title: 'Tab A' }, | |
{ key: 'b', title: 'Tab B' }, | |
{ key: 'c', title: 'Tab C' }, | |
{ key: 'd', title: 'Tab D' } | |
] | |
} | |
const reducer = (state = initialState, action) => { | |
switch (action.type) { | |
case 'CHANGE_TAB': | |
return { | |
...state, | |
index: action.index | |
} | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment