Skip to Content
react-utilsisReactFragment

isReactFragment

See source on Github 

Checks whether x is the React Fragment token or a React element whose type is Fragment.

  • @param x - Value to check
  • @returns true for the Fragment token or a fragment element, false otherwise.

Example

import { isReactFragment } from '@noaignite/react-utils' import { Fragment } from 'react' isReactFragment(Fragment) // true isReactFragment(<><span>Hello</span></>) // true isReactFragment(<div />) // false