-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
What about a mapContextToProps? #247
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
Comments
|
Why at all you need to separate mapStateToProps, mapDispatchToProps, etc. ? |
I don't think we want to rely on context in our public API. It's still subject to change. You should create an intermediate component that takes care of reading from context and rendering the child component. We don't suggest you to use context for changing data because React doesn't support this scenario well at the time (facebook/react#2517).
Check out #1 for a big discussion on this. ;-) This means a ton of unnecessary and expensive allocations, and changing function identities that kill
You can already use |
My root component have a property and I want to pass it down to any descendants that care about it. From what I've seen, please tell me if I'm wrong, the right way of doing it is through context. This way no intermediate component should know about it and keep passing it down.
The problem is my container (smart component, or whatever) doesn't have access to context to send that property to my presentational component as a prop (or does it?).
If I'm right again, is there any reason to not exist such map?
The text was updated successfully, but these errors were encountered: