Use React.ReactNode for the children prop in React TypeScript components and Render Props

Shawn Wang
InstructorShawn Wang

Share this video with your friends

Send Tweet

Because @types/react has to expose all its internal types, there can be a lot of confusion over how to type specific patterns, particularly around higher order components and render prop patterns. The widest and most recommended element type is React.ReactNode, and we build up to it by explaining the edge cases.