InterviewStack.io LogoInterviewStack.io

React Component Composition and Props Questions

Covers designing and building reusable, composable React components using props to pass data and callbacks. Includes understanding prop drilling and strategies to avoid it, controlled versus uncontrolled components, prop validation and type checking, the children prop, render prop and higher order component patterns, and when to split or combine components for clarity and reuse. Emphasizes component hierarchy design, interface stability, handling default and optional props, passing event handlers, and when to use context or other patterns instead of deep prop passing.

HardTechnical
44 practiced
You introduced a subtle bug: a child memoized component stopped updating when its parent updated a nested object prop because the parent mutated the object instead of creating a new one. Explain how to detect this bug, why immutability matters for shallow comparisons, and give two concrete fixes at the parent and child level.
HardTechnical
61 practiced
Design the TypeScript types for a `Button` component that accepts all native HTML button attributes plus a custom `variant` prop without conflicting with native `type` or `onClick` types. Show how to use `Omit` or `ComponentPropsWithoutRef` to achieve this safely.
EasyTechnical
54 practiced
What is 'prop drilling'? Provide a short example where a value must be passed through three levels of components. Name two common strategies to avoid prop drilling and briefly describe when each is appropriate (Context API, render props, lifting state, or global stores).
MediumTechnical
76 practiced
Explain `React.cloneElement`: what it does, typical use-cases (e.g., injecting props into children), and pitfalls (e.g., breaking children identity, performance). Show a short example where a `Toolbar` clones its immediate children to add an `onClick` handler.
HardTechnical
49 practiced
Outline a safe, incremental strategy to migrate a large JavaScript codebase of React components to TypeScript focusing on component props. Include steps for typing props gradually, adding `allowJs`/`checkJs` options, using `@ts-ignore` sparingly, introducing `any` as a stepping stone, and automating changes with codemods.

Unlock Full Question Bank

Get access to hundreds of React Component Composition and Props interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.