This should have been extremely easy/ Redux

Tell us what’s happening:

Your code so far


// change code below this line
const LOGIN = 'LOGIN'; 
const LOGOUT = 'LOGOUT';
// change code above this line

const defaultState = {
authenticated: false
};

const authReducer = (state = defaultState, action) => {

switch (action.type) {

  case 'LOGIN':
    return {
      authenticated: true
    }

  case 'LOGOUT':
    return {
      authenticated: false
    }

  default:
    return state;

}

};

const store = Redux.createStore(authReducer);

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

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:76.0) Gecko/20100101 Firefox/76.0.

Challenge: Use const for Action Types

Link to the challenge:

I thought this was right, but it comes in saying

The action creators and the reducer should reference the `LOGIN` and `LOGOUT` constants.

Please help. Thank you.

In order to fix

The action creators and the reducer should reference the LOGIN and LOGOUT constants.

you will need to changes lines 14, 19, 35, and 41.

2 Likes

Oh, Okay, I will take a look.

Great! All fixed. Thank you!

1 Like