Redux - Handle an Action in the Store

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/ Safari/537.36

Challenge Information:

Redux - Handle an Action in the Store

This condition 'LOGIN' will always be truthy.

From the instuctions:

you can access the action’s type directly with action.type.

but I am trying to check whether the action.type contains “LOGIN”. My question is ho to achieve the same result using the specific operrator.

Ah, ok, I see! My mistake, sorry.

From the instructions:

if it receives an action of type 'LOGIN' it returns a state object

Your function needs to return the result.