--- layout: page --- # hasComplexChildren() Returns true if the element has children that are React components, otherwise returns false. ```typescript hasComplexChildren(child: ReactNode): boolean ``` ## Arguments
children
The children array from the element where is used.
## Return Value A `boolean` which is `true` if the element has children that are React components, but `false` if it doesn't. ## Example ```jsx import React, { ReactElement, ReactNode } from 'react'; import { render } from 'react-dom'; import { hasComplexChildren } from 'react-children-utilities'; interface Props { children?: ReactNode; } const Test = ({ children }: Props): ReactElement => (
{hasComplexChildren(children) ? 'yes' : 'no'}
); const Example = (): ReactElement => ( this too ); render(, document.body); // Result: //
yes
const Example2 = (): ReactElement => these are not elements; render(, document.body); // Result: //
no
```