score:3

Accepted answer
                     // Here I recommend you use constants for your action types,
                     // ex: export const TIMEOUT = 'TIMEOUT'; in an actionsTypes.js file for example
                     // That way if you modify ^^^ it will propagate to all files everywhere,
function reducer(state, action) {
  if(action.type === 'timeOut'){                   // using what I showed in the 
      loggedIn : false,                            // example, you need 
      logoutMessage : 'Your session has timed out',// to return objects for each
      errorOpen : true,                            // if/else if that define the
    });                                            // NEW state for this reducer!
  }else if(action.type === 'error'){
    this.setState({ 
      loggedIn : false,
      logoutMessage : 'An error has occured',
      errorOpen : true,
    });
  }else if(action.type === 'logout'){
    this.setState({ loggedIn : false });
  }
}

Related Query

More Query from same tag