Tell us what’s happening:
I got the same code sample as in the solutions, but it gives the error “cannot read property ‘type’ of undefined”, but in Safari, this error does not occur and the challenge is complete. Is there something wrong with my code?
Your code so far
const defaultState = {
login: false
};
const reducer = (state = defaultState, action = loginAction) => {
// change code below this line
if (action.type === 'LOGIN') {
return {
login: true
}
} else {
return defaultState
}
// change code above this line
};
const store = Redux.createStore(reducer(true));
const loginAction = () => {
return {
type: 'LOGIN'
}
};
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.
Link to the challenge: