-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
"Unable to find element" error on <option> elements #2620
Comments
React separates the A workaround is to give a string to the var text = v1 + '(' + v2 + ')';
return <select><option value={v2}>{text}</option></select>; |
Thanks for explaining this. In such case probably the best solution would be to extend error explanation with information about "option" elements (behind "table" etc). |
Yea, we should probably do some checks in our ReactDOMOption wrapper and not allow anything but text as children. |
Just hit this http://jsfiddle.net/kg7g09cq/ |
This can be fixed by using ReactChildren.forEach in ReactDOMOption to flatten the children before passing it to the raw HTML component. Strings and numbers get concatted together; other elements should be skipped and log a warning for invalid children. |
If the contents of the
<option>
element is constructed in special way, it breaks React on component update with "Unable to find element" error. Here's an example ofrender
method body:Here's working jsfiddle (with React 0.12.0): http://jsfiddle.net/rp3fz0nf/1/
Adding
key={v2}
to option props fixes the issue.The text was updated successfully, but these errors were encountered: