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

Cant access component functions through ref #941

Closed
githubdoramon opened this issue May 10, 2017 · 2 comments
Closed

Cant access component functions through ref #941

githubdoramon opened this issue May 10, 2017 · 2 comments

Comments

@githubdoramon
Copy link

If I try to get a injectIntl component as a ref, I get a ProxyComponent, and not the component, and for this reason I can't call functions from that component.

#1
export default ComponentA;

In ComponentB I can do -> <ComponentA ref={(el) => {this.a = el}} , And then
this.a.someFunction();

#2
export default injectIntl(ComponentA);
In ComponentB I can do -> <ComponentA ref={(el) => {this.a = el}} , BUT then
this.a.someFunction() -> someFucntion is not available...

This happens because ComponentA is a ProxyComponent, and not the real component... How to solve this?

@githubdoramon
Copy link
Author

Ok... {withRef: true} and getWrappedInstance resolved the problem!

@okuryu
Copy link
Member

okuryu commented May 18, 2017

Closing this. Please file an issue if you still have any problems.

@okuryu okuryu closed this as completed May 18, 2017
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