Last active
November 10, 2017 12:17
-
-
Save shubhnik/55cb0a9f82d6eeb20004e43ee6b3e746 to your computer and use it in GitHub Desktop.
A demonstration of loginReducer.
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
// Don't forget to check the complete code here ---> https://github.com/shubhnik/redux-react-navigation/tree/authFlow | |
const initialState = { isLoggedIn: false }; | |
const loginReducer = (state = initialState, action) => { | |
switch (action.type) { | |
case "LOGIN": | |
return { ...state, isLoggedIn: true }; | |
case "LOGOUT": | |
return { ...state, isLoggedIn: false }; | |
default: | |
return state; | |
} | |
}; | |
export default loginReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment