Skip to content

FEATURE REQUEST: Accept object as a valid mapStateToProps argument #644

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

Closed
josepot opened this issue Mar 8, 2017 · 3 comments
Closed

FEATURE REQUEST: Accept object as a valid mapStateToProps argument #644

josepot opened this issue Mar 8, 2017 · 3 comments

Comments

@josepot
Copy link
Contributor

josepot commented Mar 8, 2017

I think that it would be very convenient to accept an object as a valid mapStateToProps argument. In which case, each function inside it would be assumed to be a Redux selector.

I always use reselect and I would love to be able to do:

connect({
  foo: fooSelector,
  bar: barSelector,
})

instead of doing the verbose:

connect(createStructuredSelector({
  foo: fooSelector,
  bar: barSelector,
})

I know that this is just sugar, but I think that it would be very convenient. In the same way that I love the fact that I can pass an object with action-creators as a valid mapDispatchToProps argument, I would like to be able to pass an object with selectors in the mapStateToProps argument.

@markerikson
Copy link
Contributor

This has been brought up quite a few times. There's already an open PR with a possible implementation over in #323 , although progress on it seems to have stalled. I'll close this as a dupe, since that PR would cover this.

@josepot
Copy link
Contributor Author

josepot commented Mar 8, 2017

Sorry about that @markerikson, I did check the opened Issues but I didn't checked the opened PRs. Well, I hope that PR gets merged soon. Thanks!

@markerikson
Copy link
Contributor

No worries, and thanks!

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

No branches or pull requests

2 participants