Skip to content

Instantly share code, notes, and snippets.

@shubhnik
Last active November 10, 2017 12:17
Show Gist options
  • Save shubhnik/55cb0a9f82d6eeb20004e43ee6b3e746 to your computer and use it in GitHub Desktop.
Save shubhnik/55cb0a9f82d6eeb20004e43ee6b3e746 to your computer and use it in GitHub Desktop.
A demonstration of loginReducer.
// 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