Tell us what’s happening:
Hello!
Can anybody tell me what I am doing wrong? I keep getting the error:
The action creators and the reducer should reference the LOGIN and LOGOUT constants.
But for the life of me, I have used the const for the switch cases and cannot see what is wrong.
Thanks a bunch!
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_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/use-const-for-action-types