score:1

Accepted answer

it does accept react.reactnode, but the type also contains null and undefined. it is a union type of the following:

reactchild | reactfragment | reactportal | boolean | null | undefined

the nonnullable<react.reactnode> simply ensures that null/undefined is not passed in, so it will have a type of:

reactchild | reactfragment | reactportal | boolean

you simply have to assert that children is not null/undefined, otherwise just pass in an empty string:

<container>{children ?? ''}</container>

Related Query

More Query from same tag