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

react-lite doesn't throw errors if ReactLite is loaded twice on page #119

Open
rileylnapier opened this issue Jul 20, 2017 · 2 comments
Open

Comments

@rileylnapier
Copy link

i ran into an issue yesterday where my event handlers were all firing twice. took me long time to debug and i ended up having to revert react-lite. when i reverted, i got this error

Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

i then was able to realize i had react-lite in 2 different bundles and then fixed my problem and went back to use react-lite.

would be nice to have this error in react-lite too. thoughts?

@Lucifier129
Copy link
Owner

Did you use babel-plugin-transform-react-inline-elements which included regular react?

react-lite is written by ES2015, as a UMD modules, and works with webpack alias, it is hard to load react-lite twice, and it is also hard to check that.

Maybe webpack-bundle-analyzer can help:)

@rileylnapier
Copy link
Author

no, my build just creates two bundles for one page and i didn't realize both of them had react bundled. this caused some really weird errors. react throws an error in this situation and react-lite doesn't. just fyi.

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