TypeScript · Junior · Question 68 of 75
Which type should a React component use for children that may be text, elements or nothing?
- ✓Correct answer:
React.ReactNode - 2
JSX.Element - 3
string
Explanation
ReactNode includes strings, numbers, elements, arrays, null and undefined. JSX.Element allows only a single element.