React TypeScript Quiz
Test your knowledge of using TypeScript with React, including props, events, children, refs, hooks, and common React types.
20 questions · free · answers explained
All questions in this quiz
- Why is TypeScript commonly used with React?
- Which file extension is commonly used for React components containing JSX and TypeScript?
- Which package provides TypeScript types for React itself?
- Which package provides TypeScript types for React DOM?
- What is the main purpose of a Props type or interface?
- How do you mark a prop as optional in a TypeScript props type?
- What does React.ReactNode commonly represent?
- Which type is commonly used for a click event on a button?
- Which type is commonly used for an input change event?
- What can TypeScript infer from useState when an initial string is provided?
- When might you pass a generic type argument to useState?
- What is a common type for a ref that points to an input element?
- Why is null commonly included in a ref initial value?
- Which type is commonly used for a form submit event?
- What is a discriminated union useful for in React state?
- Why should any usually be avoided in React component props?
- What does ComponentProps help you do?
- Which type can help type the props of a button wrapper component?
- What is a benefit of typing callback props?
- What should a component returning JSX usually be typed as explicitly?
Prefer to read first? React interview questions with written answers.