Handle an Action in the Store 3

Handle an Action in the Store 3
0

#1

Tell us what’s happening:

I’ve seen some other solutions in the forums and implemented them, but non seem to work :confused: ?

Any ideas?

Your code so far


const defaultState = {
  login: false
};

const reducer = (state = defaultState, action) => {
  // change code below this line
  switch (action.type) {
      case 'LOGIN':
        return Object.assign({login:true}, state);
       // also tried return Object.assign({}, state, {login:true});
      default:
        return state;
    }
};

const store = Redux.createStore(reducer);

const loginAction = () => {
  return {
    type: 'LOGIN'
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/redux/handle-an-action-in-the-store