Skip to content

Instantly share code, notes, and snippets.

@samsch
Last active March 24, 2016 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samsch/435013bb6ab38558b7f8 to your computer and use it in GitHub Desktop.
Save samsch/435013bb6ab38558b7f8 to your computer and use it in GitHub Desktop.
Intermediate/Advanced Questions about using Redux.

Is it unreasonable to have data that only exist in your selectors and as props passed down from them? For example, I might have a short list of possible items. An action creator sends the new item. The reducer replaces the state with the new item. The component could have the list of items itself, but then it's not associated with state as much as the component. If the list comes from the selector, it's more associated with the state, and can be used in multiple components.

  • Seems like it should be able to work.
  • One concern could be that the selector might be doing a job it shouldn't be.
  • The counter argument is that if you don't put it in the selector, it would need to go somewhere else, namely a component or in the state. If it's not stateful information, in the state doesn't make sense. If the component is supposed to be reusable with different list, then it doesn't make sense there either. The possible answer here is that it would go in a higher-order component or container.

samssh, yeah you make a specific component that wraps the reusable one
and the wrapper can be tied to the store
the wrapper can be as simple as a connect() call
- GreenJello, via IRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment