Redux Challenge: https://www.freecodecamp.org/learn/front-end-libraries/redux/handle-an-action-in-the-store


  login: false

};

const reducer = (state = defaultState, action) => {

  // Change code below this line

  // console.log(state.login)

return action.type === "LOGIN" ? state.login = true : state

  // Change code above this line

};

const store = Redux.createStore(reducer);

const loginAction = () => {

  return {

    type: 'LOGIN'

  }

};

while on console, I can see that state.login logs the correct value, the above given code doesn’t work.
can you please help me with this piece of code?

Remember that state shouldn’t be modified directly, but copy with change should be returned instead.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.