Tell us what’s happening:
I am trying to figure out why my ternary operator does not work here but the if/else version works.
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/126.0.0.0 Safari/537.36
Challenge Information:
Redux - Handle an Action in the Store