TypeScript · Junior · Question 22 of 75

What's the right way to type a React component's props?

Explanation

Props are a plain object, typed with an interface or a type alias. React.FC isn't required. For children use React.ReactNode; to extend native attributes, use React.ComponentProps<'button'>.

Further reading

Problem with a question

TypeScript · Junior · question 22

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz