ReactNode
The TypeScript type for anything React can render: elements, strings, numbers, arrays of these, null, undefined or booleans.
In more detail
Props such as children and named slots are usually typed as ReactNode so callers can pass any renderable content. It comes from the @types/react type definitions.
Example
children: React.ReactNodeRelated terms
- children prop — The special React prop holding whatever is placed between a component's opening and closing tags.
- slot — A place in a component's layout that the consumer fills with their own content, either through a named prop such as icon or through a Slot component.
- TypeScript — JavaScript with added type annotations, checked by a compiler before the code runs.
Taught in
- Props Contract: Immutability, Children, And Polymorphic Tags — React 19 & Modern Component Architecture
- Compound Components: Inversion of Control with Context — React 19 & Modern Component Architecture
- Higher-Order Components And Render Props: Tradeoff Analysis — React 19 & Modern Component Architecture
- Slot Patterns And Headless UI Architecture in React — React 19 & Modern Component Architecture
- Error Boundaries: componentDidCatch And Fallback UI Trees — React 19 & Modern Component Architecture
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture