-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Wrapped component by injectIntl has state always to null #210
Comments
Use: export default injectIntl(ChildComponent, {withRef: true}); Then you can access it via the following from your this.refs.child.getWrappedInstance().state |
Thank you! |
@ericf Doesn't work like you said.
But I can access to state by this way.
|
It does on 2.0.0-beta-1 |
@ericf But I'm using the |
So I see an issue, I actually forgot to return the ref, but it's definitely a function: https://github.com/yahoo/react-intl/blob/master/src/inject.js#L37 |
@ericf are we publishing this change in |
@roderickhsiao beta-2 since beta-1 was already published. I can hack-in a patch to beta-1 internally though… |
@ericf I also need this to work - any thoughts on publishing beta2? |
@ericf Can this Also, how would one use this with the decorator pattern? |
@kumarharsh it's cannot be |
Ok, I understand. I was following a pattern wherein on clicking "Submit", I'd get the values from each input via their refs. Some of those inputs can be components in themselves, which may are wrapped in |
@kumarharsh okay. Another approach is using an |
Yes, I'm using that now in some places :) |
I've encountered an issue while using the
formatMessage
method.I've wrapped a component called
ChildComponent
withinjectIntl
.Then I've used the component into another component called
FatherComponent
.The issue is that when accessing to the
ChildComponent
from theFatherComponent
the state is always null,this.refs.child.state
is always null.I'm using the new beta version.
Instead the
state
is populated correctly ifChildComponent
is not wrapper byinjectIntl
.The text was updated successfully, but these errors were encountered: