Mastodon/app/javascript/mastodon/utils/has_react_children.ts
2026-04-28 11:32:27 +00:00

13 lines
288 B
TypeScript

import { Children } from 'react';
import type { ReactNode } from 'react';
export function hasReactChildren(children: ReactNode): boolean {
if (!children) {
return false;
}
const childrenCount = Children.toArray(children).filter(Boolean).length;
return childrenCount > 0;
}