Skip to content

Instantly share code, notes, and snippets.

@nhanco
Created December 27, 2018 07:05
Show Gist options
  • Save nhanco/c0cb6d0f9af1b8f6156c000046fc6e03 to your computer and use it in GitHub Desktop.
Save nhanco/c0cb6d0f9af1b8f6156c000046fc6e03 to your computer and use it in GitHub Desktop.
perssit bug
export const toggleConfig = key => ({ type: "TOGGLECONFIG", key })
const initialState = {
darkMode: false,
element: true,
compare: true,
god: true,
immortal: true,
trieu: true,
yTuong: true,
tangBo: true,
thienMa: true,
xungKhac: true,
tuanKhong: true,
quaiThan: true,
maTinh: true,
quyNhan: true,
daoHoa: true,
hoaCai: true
}
export default (state = initialState, action) => {
switch (action.type) {
case "TOGGLECONFIG":
return {
...state,
key: !state[action.key]
}
// return !state[action.key]
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment