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

Key prop for DOM nodes is actually called 'code' #3669

Closed
rainbow-alex opened this issue Apr 14, 2015 · 2 comments
Closed

Key prop for DOM nodes is actually called 'code' #3669

rainbow-alex opened this issue Apr 14, 2015 · 2 comments

Comments

@rainbow-alex
Copy link

I was trying to fix this warning:

Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of Text. See http://fb.me/react-warning-keys for more information.

After some searching I ended up in react.js, where I found (in ReactElement.createElement):

key = config.code === undefined ? null : '' + config.code;

I finally managed to get rid of the warning by using React.createElement("li", {code: ...}) instead of React.createElement("li", {key: ...}).

This should be fixed, probably in .createElement, or at least in the docs/warning.

@syranide
Copy link
Contributor

That does not make sense, I suspect your copy of React has been modified (probably by search and replace by mistake?).

https://github.com/facebook/react/blob/master/src/classic/element/ReactElement.js#L156

@sophiebits
Copy link
Collaborator

Yeah, this isn't React – not sure where you got "code". If you search https://fb.me/react-0.13.1.js for "key = config" you'll see that our built copy has key as well.

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

3 participants