Skip to content

Using a props property in connected components #838

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
claudiorodriguez opened this issue Dec 11, 2017 · 1 comment
Closed

Using a props property in connected components #838

claudiorodriguez opened this issue Dec 11, 2017 · 1 comment

Comments

@claudiorodriguez
Copy link

Hi everyone.

It seems that passing a store property into a connected component overrides the store from the context in typical cases (i.e. not specifying a storeKey, using standard connect, etc).
This seems to be expected as you mention here https://github.com/reactjs/react-redux/blob/master/docs/api.md#L8 but it has been a surprise as the error messages resulting from trying to use the property for something else, unawares, have been a bit hard to decipher

My question is - do you think it would be a good idea to check here
https://github.com/reactjs/react-redux/blob/master/src/components/connectAdvanced.js#L122
somehow if the value of the property is an actual redux store, and throw a useful error if it's not?
Or perhaps using a different default storeKey like __store?

Cheers

@timdorr
Copy link
Member

timdorr commented Dec 11, 2017

We do this via propTypes. You should get a warning related to that if you're passing in something that doesn't match the expected shape.

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