QuizNot attempted
ReactNode vs JSX.Element for children
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
React.ReactNode
ReactNodeis everything React can render: elements, strings, numbers,null/undefined/booleans, iterables of those, and (React 19) promises, so it is the right type forchildren.- Not React.JSX.Element: that is only the result of a JSX expression, so
null,'text'and arrays are rejected. - Not React.ReactElement: same problem, it is a single element object.
- Not string | React.JSX.Element: still misses
null, numbers and arrays. - React 19 types also dropped the global
JSXnamespace, so writeReact.JSX.Elementwhen you do need it.