--:--









Quiz for Typing Props and State

Course: REACT | Subject: React | Topic: TypeScript with React



Logo

Q1: How do you define props types for a functional component?

Logo

Q2: Which keyword is used to declare types for state in class components?

Logo

Q3: How to type a state hook for a string value?

Logo

Q4: What type is usually used to type event handlers in React?

Logo

Q5: How do you declare optional props in TypeScript?

Logo

Q6: Which of these is the correct way to type children prop?

Logo

Q7: What is the type of setState function returned by useState hook?

Logo

Q8: How to type a state that can be either a string or null?

Logo

Q9: How to type a ref to an HTML input element?

Logo

Q10: What type do you use for function props?

Logo

Q11: How to type a state hook with an array of strings?

Logo

Q12: Which interface is used to type React component props?

Logo

Q13: Can you use type aliases instead of interfaces for props?

Logo

Q14: How to type a React component returning null?

Logo

Q15: Which type describes any React element?

Logo

Q16: How to define default props in functional components?

Logo

Q17: What happens if you don't type props in TypeScript?

Logo

Q18: How to type an event for form submission?

Logo

Q19: Which generic type is used with useReducer hook?

Logo

Q20: How to type a callback ref in TypeScript?

Are you ready to start test? Set your time limit