trivalleycoders-org / events-client

Display any type of event. Link to your ticketing/registration site
MIT License
2 stars 6 forks source link

Defaults for state #85

Closed klequis closed 6 years ago

klequis commented 6 years ago

Is it best to control defaults for state from reducers or selectors Issue with reducer option I see is the established convention is to just return state and would be breaking that convention. If use selectors they would all have logic

if (state.something === null) 
  return someDefaultValue
else
  return state.someValue

However, default values are also set in the declaration of reducer. e.g.,

const someReducer = (state = {}, {type, payload})

Using auth-selectors/getLoggedIn as an example

therefore, default values should be set in the selector