There are two common types to describe the children of a component.
React.ReactNode
: it is a union of all the possible types that can be passed as children in JSX, it is a very broad definition of children:
interface ModalRendererProps {
title: string;
children: React.ReactNode;
}
React.ReactElement
, same asReact.JSX.Element
: it is only JSX elements and not Javascript primitives like strings or numbers:
interface ModalRendererProps {
title: string;
children: React.ReactElement;
}
See https://react.dev/learn/typescript