Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to compose an array of selectors in createSelector #192

Closed
avatsaev opened this issue Jul 26, 2017 · 2 comments
Closed

Ability to compose an array of selectors in createSelector #192

avatsaev opened this issue Jul 26, 2017 · 2 comments

Comments

@avatsaev
Copy link

avatsaev commented Jul 26, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request
[ ] Support request

What is the current behavior?

Currently we can only pass selector functions to createSelector arguments

Expected behavior:

It would be useful to be able to pass an array of selectors to an argument of createSelector, which will return two values for the next selector in the composition

Minimal reproduction of the problem with instructions:

From: https://github.com/reactjs/reselect#composing-selectors

const getKeyword = (state) => state.keyword

const getVisibleTodosFilteredByKeyword = createSelector(
  [ getVisibleTodos, getKeyword ],
  (visibleTodos, keyword) => visibleTodos.filter(
    todo => todo.text.includes(keyword)
  )
)

Most selectors take in one argument (usually the state), but in some cases a selector can take 2 or more arguments, composing an array of selectors can help to form the number arguments for the next selector.

💗 ngrx? Please consider supporting our collective: 👉 donate

@timdeschryver
Copy link
Member

Maybe a dumb question, but do you accept a PR for this? Asking because this issue doesn't have the label 'Accepting PRs'.

@brandonroberts
Copy link
Member

Sure, we'll take a PR for this

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

No branches or pull requests

3 participants