Created
September 29, 2020 18:19
-
-
Save reireynoso/b2e8635e4d08d8269094af23806c58bf to your computer and use it in GitHub Desktop.
Context API reducer
This file contains hidden or 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
export const initialState = { | |
view: "home" | |
}; | |
const reducer = (state, action) => { | |
switch (action.type) { | |
case "SET_VIEW": | |
return { | |
...state, | |
view: action.view | |
}; | |
default: | |
return state; | |
} | |
}; | |
export default reducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment