Use a Switch Statement to Handle Multiple Actions need

Tell us what’s happening:

Your code so far


const defaultState = {
  authenticated: false
};

const authReducer = (state = defaultState, action) => {
  // change code below this line
switch(action.type){
  case 'LOGIN':
  return {autheticated:true};
  case 'LOGOUT':
  return {autheticated:false};
  default:return defaultState;
}
  // change code above this line
};

const store = Redux.createStore(authReducer);

const loginUser = () => {
  return {
    type: 'LOGIN'
  }
};

const logoutUser = () => {
  return {
    type: 'LOGOUT'
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/use-a-switch-statement-to-handle-multiple-actions/

Spelling…

1 Like

God!!!
thanks man
i didn’t see that