@samitouri / QOS-React / commits / a5025b1610

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

XaveScor committed Dec 11, 2017 at 09:25 UTC a5025b161048c4e7211cf4c7298df7fcfc03bfa0
1 file changed +4 -3
packages/react/src/ReactElementValidator.js
+4 -3
@@ -281,8 +281,9 @@ export function createElementWithValidation(type, props, children) {
281 const validType =
282 typeof type === 'string' ||
283 typeof type === 'function' ||
284 - typeof type === 'symbol' ||
285 - typeof type === 'number';
284 + // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
285 + type === REACT_FRAGMENT_TYPE;
286 +
287 // We warn in this case but don't throw. We expect the element creation to
288 // succeed and there will likely be errors in render.
289 if (!validType) {
@@ -336,7 +337,7 @@ export function createElementWithValidation(type, props, children) {
337 }
338 }
339
339 - if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) {
340 + if (type === REACT_FRAGMENT_TYPE) {
341 validateFragmentProps(element);
342 } else {
343 validatePropTypes(element);