Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

React.createElement(type, { key: undefined }) is handled incorrectly #6879

Closed
gaearon opened this issue May 25, 2016 · 0 comments
Closed

React.createElement(type, { key: undefined }) is handled incorrectly #6879

gaearon opened this issue May 25, 2016 · 0 comments

Comments

@gaearon
Copy link
Collaborator

gaearon commented May 25, 2016

I believe #5744 introduced a behavioral difference between development and production versions of React. We released it as a part of 15.0, and this difference still exists.

The production behavior hasn’t changed. However the development behavior diverged after this change.

var el = React.createElement('div', { key: undefined })
document.body.innerHTML = (typeof el.key) + ' ' + el.key

What do you expect to appear?

0.14.x

15.x

The 15.x dev behavior is different because dev code path only checks the existence of a property but not whether it’s undefined whereas the prod code path checks for undefined explicitly.

React.cloneElement() is not affected because it doesn’t include those warnings.


This doesn’t seem like a major problem (nobody noticed it!) in the real world, but I think we should fix this.
I have a related fix in the works so I’ll add some more tests and include it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant