Handle an Action in the Store "Cannot read property 'type' of undefined"

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:
https://learn.freecodecamp.org/front-end-libraries/redux/handle-an-action-in-the-store

You have added code you were not asked to add. Your code should only go between the two comments.

// change code below this line

// change code above this line

This is causing the test to fail

const store = Redux.createStore(reducer(true));