@project44-manifest/react
Version:
Manifest Design System react components
16 lines (13 loc) • 373 B
text/typescript
import React from 'react';
export function useChildrenTextContent(children?: React.ReactNode) {
const childrenTextContent = React.useMemo(
() =>
children === undefined
? ''
: React.Children.toArray(children)
.filter((child) => typeof child === 'string')
.join(' '),
[children],
);
return childrenTextContent;
}