Fail to understand why the test cases are failing for this logic. The console.log statement returns the state object as expected.
Describe your issue in detail here.
Is it necessary to have a new variable to track the state object and return it? I am using the dot notation here to change the value of authenticated.
**Your code so far**
const defaultState = {
authenticated: false
};
const authReducer = (state = defaultState, action) => {
switch (action.type) {
case ‘LOGIN’:
state.authenticated = true;
break;
case ‘LOGOUT’:
state.authenticated = false;
break;
default:
return defaultState
}
console.log(state)
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/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53
Challenge: Use const for Action Types
Link to the challenge: