There are different ways in which we can build shareable code in react:
Hooks
Higher Order Components
Render Props
Component composition
How would you extract a button component so it can be used on two different pages without duplicating code?
If you create a custom hook for data fetching, where do you place the file and how do you import it in a component?
What happens if you import the same component using two different relative paths in a small React app?
We need a modal that appears in several places but each usage requires slightly different styling. How would you design it for reuse and what pitfalls might you watch for?
After moving a shared utility into a new folder, the production build started throwing ‘module not found’ errors. Walk me through how you’d debug this.
Why did wrapping a list item with a higher‑order component for authentication cause unexpected re‑renders, and how would you fix it?
Our organization wants a shared component library across multiple React apps with different theming needs. How would you structure the library, handle versioning, and keep bundle impact low?
Introducing a custom‑hook library caused a memory leak in a high‑frequency component. How would you identify the leak and resolve it?
Compare using a monorepo versus separate repos for sharing UI components across teams. What are the trade‑offs in terms of CI, dependency management, and team autonomy?
We have legacy codebases using class components and a new codebase using functional components with hooks. Outline a migration strategy for shared utilities and components that minimizes disruption.
Design a governance model for a company‑wide React component library that balances product‑team autonomy with consistency and long‑term maintainability.
A critical security vulnerability is discovered in a shared npm package used by dozens of services. How would you coordinate the fix and rollout across the organization?