React Curriculum

React TypeScript Interview Questions

React TypeScript interview questions matter because TypeScript is mandatory across modern FAANG frontend engineering teams. Interviewers expect candidates to write strictly typed components, avoid any, and use advanced generic constraints.

Master the distinction between ReactNode and ReactElement, accurately type DOM refs versus mutable containers, build generic table and dropdown components that infer data row types, and type polymorphic components that dynamically validate HTML attributes.

The lessons build from the types every React codebase needs, props, children and event handlers, through typing useState, useReducer and refs to DOM elements, to the two patterns senior interviews use to separate candidates: generic components such as a type-safe table or select, and polymorphic components that take an as prop and still type the props of the element they render.

Interviewers ask these to see whether you can make the compiler catch real bugs rather than silencing errors with any.

React TypeScript Interview Questions: 4 lessons

Frequently asked questions

How do you type children in a React component with TypeScript?

Use React.ReactNode for anything React can render: elements, strings, numbers, arrays and null. Use React.ReactElement only when you need an actual element, and PropsWithChildren<P> to add children to an existing props type.

How do you type an onChange event in React with TypeScript?

Use the event type for the element: React.ChangeEvent<HTMLInputElement> for an input or React.ChangeEvent<HTMLSelectElement> for a select. event.target is then typed, so event.target.value is a string without a cast.

What is a polymorphic component in React?

A component that renders a different element or component depending on an as prop, such as a Button that can render an a or a router Link, while TypeScript checks that the props you pass are valid for that element. It is typed with a generic over the element type and React.ComponentPropsWithoutRef.