Skip to content

Commit a5025b1

Browse files
XaveScorgaearon
authored andcommitted
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
1 parent abdbb16 commit a5025b1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/react/src/ReactElementValidator.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,9 @@ export function createElementWithValidation(type, props, children) {
281281
const validType =
282282
typeof type === 'string' ||
283283
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+
286287
// We warn in this case but don't throw. We expect the element creation to
287288
// succeed and there will likely be errors in render.
288289
if (!validType) {
@@ -336,7 +337,7 @@ export function createElementWithValidation(type, props, children) {
336337
}
337338
}
338339

339-
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) {
340+
if (type === REACT_FRAGMENT_TYPE) {
340341
validateFragmentProps(element);
341342
} else {
342343
validatePropTypes(element);

0 commit comments

Comments
 (0)