Redux - Handle an Action in the Store

Tell us what’s happening:
I chose to use a ternary operator and i dont understand why its not working and i have to use a for loop to make it work

Your code so far

const defaultState = {
  login: false
};

const reducer = (state = defaultState, action) => {
  // Change code below this line
  action.type === "LOGIN" ? {login: true}:state;
  // Change code above this line
};

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/117.0.0.0 Safari/537.36 Edg/117.0.2045.47

Challenge: Redux - Handle an Action in the Store

Link to the challenge:

you forget the return keyword

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