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

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 #131

Closed
laitang2000 opened this issue Nov 10, 2015 · 8 comments
Labels

Comments

@laitang2000
Copy link

Using the library as a Browser global I get the following error message

"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"

Script references are -

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
<script src="https://fb.me/react-0.14.2.min.js"></script>
<script src="https://fb.me/react-dom-0.14.2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="underscore.js"></script>
<script src="react-bootstrap-table.min.js"></script>

any ideas on how I can resolve this?

Thanks

@AllenFang
Copy link
Owner

HI, could you give me the sample code? and did you use RequireJS to import react-bootstrap-table?

@laitang2000
Copy link
Author

Hi,

The code I'm testing with https://gist.github.com/laitang2000/dd5b67cc8a44cc2d3a86#file-example-html

The script and css references are all cdn except for your library.

No I'm not using RequireJs.

Thanks

@AllenFang
Copy link
Owner

Maybe you dont use this style(write down the code on html) to write you application, I'm not sure the problem, but I think you can use webpack or browserify to bundle you module and include to you html, this error should not be happened. Anyway, I'll find the root cause :)

@AllenFang AllenFang added the bug label Nov 10, 2015
@npillarikuppam
Copy link

I see the same problem -
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).

Please find the code base here - https://gist.github.com/npillarikuppam/104fe8f3fdee3535a24f

@AllenFang
Copy link
Owner

thanks, I'll spend some time on this problems.

@laitang2000
Copy link
Author

Thanks, this library is pretty awesome :)

@ZtF
Copy link

ZtF commented Nov 11, 2015

+1

@AllenFang
Copy link
Owner

Fix it on v1.2.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants