skortchmark9/reselect-tools

missing documentation on using with props?

MattCowski opened this issue · 2 comments

Based on https://github.com/reduxjs/reselect#accessing-react-props-in-selectors
What's the proper way on adding selectors that depend on mock or hard-coded or static props? (for development, only trying to test with 1 id passed from parent)

A way I've solved this is by setting a default. So with the above linked example, you would pass exampleProps:

const exampleProps = {listId: 123}
const getTodos = (state, props=exampleProps) =>
  state.todoLists[props.listId].todos
...

Cool! I personally don't use selectors with props in my applications, so I never designed around that use case. I'm glad you found a workaround though.