fix #11759. false positive warning in IE11 when using React.Fragment (#11823)

* fix #11759. false positive warning in IE11 when using React.Fragment

* simplify createElementWithValidation type check

* fix mistake

* Add an explanation

* We shouldn't use `number` for anything else

* Clarify further
This commit is contained in:
XaveScor authored and Dan Abramov committed 2017-12-11 03:25:28 +00:00
1 parent abdbb16d4b
commit a5025b1610
1 file changed
+4 -3
+4 -3
View File
@@ -281,8 +281,9 @@ export function createElementWithValidation(type, props, children) {
const validType =
typeof type === 'string' ||
typeof type === 'function' ||
typeof type === 'symbol' ||
typeof type === 'number';
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE;
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {
@@ -336,7 +337,7 @@ export function createElementWithValidation(type, props, children) {
}
}
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) {
if (type === REACT_FRAGMENT_TYPE) {
validateFragmentProps(element);
} else {
validatePropTypes(element);