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

Avoid 'Uncaught Error: removeComponentAsRefFrom' #48

Closed
wants to merge 1 commit into from

Conversation

anhhnt
Copy link

@anhhnt anhhnt commented Jun 1, 2017

Hello,

I faced this error when using with React 15.5.4, however, I couldn't reproduce it. I managed to fix by using ref={function} instead of ref="string"

Uncaught Error: removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded

Hopefully it get merged

Thank you!

@@ -8,6 +8,8 @@ export default class ReCAPTCHA extends React.Component {
this.handleExpired = this.handleExpired.bind(this);
}

captchaEl = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is causing the Travis build to fail.

Is declaring captchaEl = null actually needed?

@dozoisch
Copy link
Owner

dozoisch commented Jun 1, 2017

Thanks! I'll get it merge by tonight

@dozoisch
Copy link
Owner

dozoisch commented Jun 2, 2017

I can change it to a function ref, although looking around this issue seems to be caused most of the time by multiple version of react being included. (eg: mui/material-ui#648)

You should probably ensure your build is not including multiple version from package having different requirements since it looks like you just updated to 15.5.4!

@anhhnt
Copy link
Author

anhhnt commented Jun 2, 2017

Hi dozoisch,
I've checked with npm ls react and there is only 15.5.4 in result.
Could you help to fix the build and get it merged.
Thanks

@dozoisch
Copy link
Owner

dozoisch commented Jun 2, 2017

Yep! I'll get it merged, just wanted to make sure it was the actual issue!

@dozoisch
Copy link
Owner

dozoisch commented Jun 2, 2017

Just released 0.9.5 with ref as a function!

@dozoisch dozoisch closed this Jun 2, 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

Successfully merging this pull request may close these issues.

3 participants