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
no warning message for component reusage in development enviroment #8798
Comments
Please provide a project reproducing the problem. It is not obvious from your description what is going wrong, but development and production mode should behave identically (except that errors are more verbose in development mode). For your particular error, it looks like you might be bundling two copies of React on the same page. In fact this is exactly what the error says:
Have you checked the suggested documentation page and verified it’s not the case? |
Judging by your code snippet, it might be a problem if your By the way, why are you creating |
thanks for reply, yes this components created out of render method. I'm using custom loader for roots, just refactored it in search of this issue source and got nothig, works like a charm. The problem is in the ref added by loader create roots like this:
with minified version first TinyMCE is loaded, then throw exceptions. With dev version everything work fine.
|
First of all, your use of React is highly unidiomatic. It is not clear at all why you create an element in constructor, or why you put it in the state. This is unnecessary and you should generally just create it in the render method instead. As explained by the error message you have seen, string refs only work when the element is created inside the
That is indeed why this doesn't work. This limitation is exactly why we don't recommend string refs anymore, and suggest using callback refs instead. They don't have this problem and are described on this page: https://facebook.github.io/react/docs/refs-and-the-dom.html At some point string refs will be deprecated so I suggest switching to callback refs. I hope this helps! I don't see anything actionable for us here. I would recommend refactoring your code to remove the constructor altogether and create the element in render function. If you don't want to do it, you have to replace the string ref with a callback ref. |
When i use full version of react everything works fine, no exceptions/warnings. With minified version i've got "Uncaught Error: Minified React error #119; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=119 for the full message or use the non-minified dev environment for full errors and additional helpful warnings." thrown from ReactDom.render on some components.
tested in chrome,firefox. React v15.4.2 from
"https://unpkg.com/react@15/dist/react.js"
"https://unpkg.com/react-dom@15/dist/react-dom.js"
I've found real problem: "component that was not created inside a component's
render
method". Just like this:Few instances of this component did render, some subcomponents do work, others - don't. In most cases first subcomponent of type do render fine, others fail. I think there must be some kind of warning for such cases or more info in docs.
The text was updated successfully, but these errors were encountered: