Protect better against createElement(null/undefined)#2726
Merged
zpao merged 1 commit intofacebook:masterfrom Dec 17, 2014
Merged
Protect better against createElement(null/undefined)#2726zpao merged 1 commit intofacebook:masterfrom
zpao merged 1 commit intofacebook:masterfrom
Conversation
Member
Author
|
Based on #2607 if we take this we should backport to 0.12 |
2eb6299 to
6640471
Compare
Member
Author
|
Updated after talking to @sebmarkbage - creating the element should apparently be allowed (since in theory it's totally possible to create an element literal with undefined type), though we may throw when rendering. We'll warn in DEV (thus the use of ReactElementValidator) but not in prod. |
src/classic/element/ReactElement.js
Outdated
This adds a warning to React.createElement in __DEV__ about using null or undefined. This is technically valid since element creation can be considered safe and usable in multiple rendering environments. But rendering in a DOM environment with an element with null/undefined type is not safe.
6640471 to
50a0d69
Compare
zpao
added a commit
that referenced
this pull request
Dec 17, 2014
Protect better against createElement(null/undefined)
zpao
added a commit
to zpao/react
that referenced
this pull request
Dec 18, 2014
Protect better against createElement(null/undefined) Conflicts: src/classic/element/__tests__/ReactElementValidator-test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a warning to React.createElement in DEV about using null
or undefined. This is technically valid since element creation can be
considered safe and usable in multiple rendering environments. But
rendering in a DOM environment with an element with null/undefined type
is not safe.
Fixes #2607