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
Object spreads with nested children gives unwanted key error. #10477
Comments
Hey @bonjowi!
Unfortunately, it's hard to help if we can't reproduce the issue. If it's not occurring in the JSFiddle that means there's likely some other reason the key warning is being triggered. It sounds like Could you try to write up a minimal example reproducing the issue that we could look at? |
@aweary Thanks for your time. Adding the same case in a create-react-app project does not cause the same error. So it's presumably something else than react causing this problem. I'm currently trying to figure out what's wrong. I'll get in touch after I have found the problem. |
Wild guess: maybe you have a production-only transform like |
Thanks @gaearon I can confirm that babel-plugin-transform-inline-elements is causing the problem. I started stripping my webpack configs etc. and found out what's causing the problem. If you're interested I can upload a repository to reproduce the issue. But any way, this is not an issue for this repository. My mistake. Thanks for the help! |
This is expected. The Babel doc page for both plugins says they're going to cause confusing warnings if used in development. |
I believe the following case should not result with a key error. So I would like to know if this is correct behaviour or a bug.
I have produced the following case
Render a component which spreads attributes on it's top element, with children.
The children are nested and at least one child has an object spread.
This situation produces the following key error
Reproduction
I've added the most basic code to reproduce the issue in a JSFiddle. However, I don't see the key error being displayed on JSFiddle.
Variations:
given to Component the key warning is not thrown.
Expectation
I would not expect key errors because there are no arrays of children being rendered.
Background
Build with react@15.6.1 and react-dom@15.6.1
I've started getting this problem since I started using airbnb/react-with-styles with aphrodite for styling. It generates objects with possibly both style and className properties which can be spread on to JSX elements. However, the issue persists when react-with-styles is not used. The behaviour seems to come from react.
Is this correct behaviour?
The text was updated successfully, but these errors were encountered: