chore: add isValidElement for isFragment (#38056)

pull/37957/head^2
lijianan 2 years ago committed by GitHub
parent 14b83d97b5
commit a2de8f7b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@ import * as React from 'react';
export const { isValidElement } = React; export const { isValidElement } = React;
export function isFragment(child: React.ReactElement): boolean { export function isFragment(child: React.ReactElement): boolean {
return child && child.type === React.Fragment; return child && isValidElement(child) && child.type === React.Fragment;
} }
type AnyObject = Record<PropertyKey, any>; type AnyObject = Record<PropertyKey, any>;

Loading…
Cancel
Save