Redux what is wrong here

Tell us what’s happening:

Can t pass

Your code so far


// change code below this line
const LOGIN = "LOGIN";
const LOGOUT = "LOGOUT";

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

const logoutUser = () => {
return {
  type: 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Use const for Action Types

Link to the challenge:

Hello! Please read what the exercise is asking you to do.

Declare LOGIN and LOGOUT as const values and assign them to the strings 'LOGIN' and 'LOGOUT' , respectively. Then, edit the authReducer() and the action creators to reference these constants instead of string values.

You are still using string values “LOGIN” and “LOGOUT” in authReducer(), instead of their “const equivalents”.

ye am kind of too fast and my English is shiit.

1 Like

Yeah, this happens to me too. Trying to get all of the certificates may lead to solve the exercises fast, instead of getting the main idea of each one. My English isn’t the best neither, but focus in incorporating important concepts instead of getting over challenges mindlessly. I’m still improving on this, but it really makes a difference in your learning process.

1 Like