Hello
Not sure if this is the right place for it, but can anyone explain to me why the following doesn’t work please?
const reducer = (state = defaultState, action) => {
// change code below this line
if (action.type === 'LOGIN') {
state.login = true;
}
return state;
// change code above this line
};
The challenge says:
Fill in the body of the reducer
function so that if it receives an action of type 'LOGIN'
it returns a state object with login
set to true
.
So should we not be updating the state object’s ‘login’ value to true, rather than returning an anonymous object?
Maybe I’m missing something, but thanks if you can help out?
Thanks,
Z
65 Likes