React `children` prop type
a few seconds agoif you created a React Typescript component and you want to pass children
props. But if you don’t remember what children
type is, use built-in PropsWithChildren
type
via atlj
import type { PropsWithChildren } from "react";
type Props = PropsWithChildren<{
value: string;
}>;
// Props will contains `children`
const MyComponent = ({ value, children }: Props) => {
return <div className={value}>{children}</div>;
};