React Interview Map
React Interview Map
Generated by [Link]
– “What’s the difference between a function and class component?”
(Functions + Hooks are now standard; classes use this and
lifecycle methods.)
– “Can a React component return multiple elements?” (Yes, with
fragments.)
– “What makes a valid React component?” (It must start with a capital
letter and return something renderable.)
• Key subtopics: Function components, class components, pure
components, presentational vs. container components, component trees,
default props.
1.4 Props (Properties)
• Explanation: Props are read-only inputs passed from parent to child.
They make components reusable and configurable. Props flow down the
tree.
• Why it matters in interviews: Props are the foundation of React’s data
flow. Misunderstanding immutability of props is a red flag.
• Common interview questions/traps:
– “Are props mutable?” (No. Components must never modify their
own props.)
– “How do you pass data from child to parent?” (Via callback
functions passed as props—this is not reverse props flow.)
– “What happens if you mutate props?” (React won’t detect it; bugs
will be silent and hard to trace.)
• Key subtopics: Passing data down, callback props,
prop-types/TypeScript, default props, children prop, prop drilling,
destructuring props, spread operator with props.
1.5 State
• Explanation: State is mutable data owned by a component. When state
changes, React re-renders the component. In function components,
useState is the primary tool.
Generated by [Link]
• Why it matters in interviews: State management is the core of React.
Interviewers probe for understanding of closures, batching, and
asynchronous updates.
• Common interview questions/traps:
– “Why can’t you update state directly?” (React won’t re-render;
always use the setter function.)
– “Is state update synchronous or asynchronous?” (State updates
may be batched; the new value isn’t available immediately after
calling the setter.)
– “What happens if you call setState multiple times in one event
handler?” (React batches them. Use the functional updater form if
the next state depends on the previous state.)
• Key subtopics: useState, functional updates, initial state laziness, state
batching, object vs. primitive state, derived state, state vs. props.
Generated by [Link]
• Key subtopics: SyntheticEvent, event pooling (legacy), passing
parameters, onClick vs. onSubmit, event delegation in React, preventing
default behavior.
2.2 Conditional Rendering
• Explanation: Render different UI based on state or props using
JavaScript logic (if, ternary ? :, logical &&).
• Why it matters in interviews: Simple but frequently tested for edge
cases, especially with 0, "", and false rendering.
• Common interview questions/traps:
– “What’s the difference between condition && <Component />
and condition ? <Component /> : null?” (&& can render 0 or
"" unexpectedly.)
Generated by [Link]
• Why it matters in interviews: This is the canonical React pattern before
reaching for Context or Redux. Shows you understand React’s data flow
philosophy.
• Common interview questions/traps:
– “When should you lift state up?” (When two or more components
need to reflect the same changing data.)
– “What’s the downside of lifting state too high?” (Prop drilling—
passing props through many intermediate components that don’t
need them.)
• Key subtopics: Shared state ownership, inverse data flow (callbacks),
prop drilling problem, identifying the “source of truth.”
3.2 Component Composition
• Explanation: Composition is React’s primary reuse mechanism. Use
children prop and explicit component slots to build flexible, reusable
components.
• Why it matters in interviews: Interviewers prefer composition over
inheritance questions. React explicitly favors composition.
• Common interview questions/traps:
– “How do you share behavior between components?” (Composition,
custom hooks, HOCs, render props—not inheritance.)
– “What is the children prop?” (Whatever is between opening and
closing tags of a component.)
– “What are slots in React?” (Multiple composition points using
explicit props that accept elements.)
• Key subtopics: children prop, multiple slots, specialization
vs. containment, [Link], passing elements as props,
layout components.
Generated by [Link]
3.3 Context API
• Explanation: Context provides a way to pass data through the component
tree without prop drilling. It’s designed for globally shared data (theme,
auth, locale).
• Why it matters in interviews: Context is frequently misused for state
management. Interviewers test whether you know its limitations.
• Common interview questions/traps:
– “Does Context replace Redux?” (No. Context is for dependency
injection, not complex state management. It doesn’t provide
middleware, time-travel debugging, or optimized selectors.)
– “What happens when Context value changes?” (All consumers re-
render, even if they only use part of the value.)
– “How do you prevent unnecessary re-renders with Context?” (Split
into multiple contexts, or use a state management library with
selectors.)
– “When should you NOT use Context?” (For frequently changing
data or when only a few components need the data—prop drilling is
fine for shallow trees.)
• Key subtopics: [Link], Provider and Consumer,
useContext, default values, context splitting, context performance issues,
useReducer + Context as a lightweight state solution.
Generated by [Link]
• Common interview questions/traps:
– “What does the dependency array do?” (Controls when the effect
runs. Empty [] = mount/unmount only. Missing = every render.
Filled = when those values change.)
– “Why is my effect running twice in development?” (React 18 Strict
Mode intentionally double-invokes effects to help detect impure
setup/cleanup.)
– “How do you mimic componentDidMount?” (useEffect(() =>
{...}, []) — but remember it runs after paint, not before.)
Generated by [Link]
– “What’s the difference between componentDidMount and
useEffect?” (componentDidMount runs once after initial render;
useEffect runs after every render by default, controlled by deps.)
Generated by [Link]
– “What are callback refs?” (A function that receives the DOM node,
useful for dynamic ref assignment.)
• Key subtopics: useRef, createRef, callback refs, forwardRef, ref
forwarding patterns, useImperativeHandle, refs vs. state, storing interval
IDs in refs, measuring DOM elements.
4.4 Portals
• Explanation: Portals let you render children into a DOM node that exists
outside the parent component’s DOM hierarchy.
• Why it matters in interviews: Important for modals, tooltips, and overlays
where CSS overflow: hidden or z-index stacking contexts cause
issues.
• Common interview questions/traps:
– “Does a portal break event bubbling?” (No. Event bubbling still
works according to the React tree, not the DOM tree.)
– “When would you use a portal?” (Modals, dropdowns, toasts—
anything that needs to escape parent CSS constraints.)
• Key subtopics: [Link], event bubbling through
portals, use cases (modals, tooltips).
Generated by [Link]
– “Is Virtual DOM always faster than direct DOM manipulation?”
(No. It’s faster in complex, dynamic UIs because it batches and
minimizes DOM operations. For simple updates, direct DOM can be
faster.)
– “How does React diff the Virtual DOM?” (Element-by-element
comparison using keys, not tree-diffing algorithms like O(n³).)
• Key subtopics: React elements vs. DOM nodes, reconciliation process,
diffing algorithm, why React uses keys, render phase vs. commit phase.
5.2 Reconciliation
• Explanation: Reconciliation is React’s algorithm for diffing one tree with
another to determine which parts need to be changed in the DOM. It’s
O(n) and relies on two assumptions: different types produce different
trees, and keys hint at stable identity.
• Why it matters in interviews: Senior roles expect deep understanding of
how React decides what to update.
• Common interview questions/traps:
– “What are the two assumptions React’s diffing algorithm makes?”
(1. Two elements of different types produce different trees. 2. Keys
hint at which child elements are stable across renders.)
– “What happens when a component’s type changes at the same
position?” (React unmounts the old tree and mounts the new one
entirely—even if the types are similar.)
– “Why are keys important for reconciliation?” (They tell React
whether an element is the same logical item across renders.)
• Key subtopics: Diffing rules, type comparison, key-based matching,
component unmounting/remounting, reconciliation and state preservation.
5.3 Memoization — [Link], useMemo, useCallback
• Explanation: Memoization prevents unnecessary re-renders or
recalculations. [Link] memoizes components, useMemo memoizes
values, useCallback memoizes functions.
Generated by [Link]
• Why it matters in interviews: Performance optimization is a senior-level
topic. Misusing memoization is worse than not using it—interviewers test
for nuance.
• Common interview questions/traps:
– “When should you use [Link]?” (When a component receives
the same props frequently but re-renders due to parent updates.
Not a default—memoization has a cost.)
– “What’s the difference between useMemo and useCallback?”
(useMemo returns a memoized value; useCallback returns a
memoized function. useCallback(fn, deps) is equivalent to
useMemo(() => fn, deps).)
Generated by [Link]
• Common interview questions/traps:
– “If you call setState three times in one click handler, how many re-
renders happen?” (One—React batches them.)
– “What changed in React 18 regarding batching?” (Automatic
batching for all updates, not just React event handlers.)
– “How do you force a synchronous re-render?” (flushSync—but it’s
an escape hatch and can hurt performance.)
– “What is the render phase vs. commit phase?” (Render =
calculating what changes. Commit = applying changes to the DOM.
Render can be interrupted; commit cannot.)
• Key subtopics: Automatic batching (React 18), flushSync, render
phase, commit phase, concurrent rendering, time slicing, priority updates.
Generated by [Link]
– “What’s wrong with calling a hook conditionally?” (React relies on
call order to match state to hooks. Conditional calls break this.)
• Key subtopics: Rules of Hooks, extracting logic, hook composition,
usePrevious, useDebounce, useLocalStorage, useMediaQuery, testing
custom hooks.
6.2 Error Boundaries
• Explanation: Error boundaries are React components that catch
JavaScript errors anywhere in their child tree, log them, and display a
fallback UI. They only catch errors during rendering, lifecycle methods,
and constructors—not event handlers or async code.
• Why it matters in interviews: Error boundaries are the only way to
handle render-phase errors gracefully. Interviewers test the boundaries of
their capabilities.
• Common interview questions/traps:
– “Can you use error boundaries in function components?” (Not
directly. You must create a class component for
componentDidCatch or use a library.)
Generated by [Link]
• Why it matters in interviews: Performance is critical at scale.
Interviewers want to know you can optimize initial load time.
• Common interview questions/traps:
– “What is [Link]?” (A function that lets you render a dynamic
import as a regular component.)
– “Can you use [Link] outside of Suspense?” (No. [Link]
components must be wrapped in a Suspense boundary with a
fallback.)
– “What are the tradeoffs of code splitting?” (More HTTP requests,
potential layout shift, need for loading states.)
• Key subtopics: Dynamic import(), [Link], Suspense for code
splitting, route-based splitting, preloading strategies, bundle analysis.
6.4 Suspense
• Explanation: Suspense lets components “wait” for something before
rendering—initially for code splitting, now expanding to data fetching (with
frameworks like [Link] or Relay).
• Why it matters in interviews: Suspense is a major modern React
paradigm. Interviewers test whether you understand it’s not just a loading
spinner wrapper.
• Common interview questions/traps:
– “Can Suspense be used for data fetching in vanilla React?” (Not
officially recommended without a framework or experimental APIs.)
– “What happens if multiple components inside Suspense are
loading?” (Suspense shows the fallback until ALL children are
ready.)
– “How do nested Suspense boundaries work?” (They show their
own fallbacks independently—inner boundaries don’t trigger outer
ones if already resolved.)
• Key subtopics: Suspense component, fallback UI, nested boundaries,
Suspense for data fetching (conceptual), startTransition.
Generated by [Link]
Section 7: Advanced — Architecture & State Management
7.1 State Management Patterns
• Explanation: Beyond useState, complex apps need patterns for global
state: lifting state, Context + useReducer, external libraries (Redux,
Zustand, Jotai, Recoil), or server-state libraries (React Query, SWR,
Apollo).
• Why it matters in interviews: Architecture decisions separate mid-level
from senior engineers. You must justify your choices.
• Common interview questions/traps:
– “When do you need Redux?” (Not for every app. Use it for complex
global state with many interdependent updates, time-travel
debugging needs, or middleware requirements.)
– “What’s the difference between client state and server state?”
(Client state = UI state (theme, form data). Server state = data from
API that needs caching, synchronization, and background updates.)
– “What is useReducer and when should you use it?” (For complex
state logic with multiple sub-values or when next state depends on
previous state. Cleaner than multiple useState calls.)
– “Compare Redux, Zustand, and Context.” (Redux: predictable,
middleware, devtools. Zustand: minimal, no providers. Context:
built-in, but no selectors and causes broad re-renders.)
• Key subtopics: useReducer, Redux core concepts (store, actions,
reducers, dispatch), Zustand, Jotai/Recoil (atomic state), React
Query/SWR (server state), normalized state, selectors, immutability
requirements.
7.2 Routing (React Router)
• Explanation: React Router is the standard library for routing in React. It
enables navigation without page reloads using the History API.
Generated by [Link]
• Why it matters in interviews: Most React apps are SPAs. You need to
understand routing patterns, guards, and data loading.
• Common interview questions/traps:
– “What is client-side routing?” (Updating the URL and UI without a
server round-trip.)
– “How do you pass state through navigation?” (Using the state
property in useNavigate or <Link>.)
– “What are route guards and how do you implement them?”
(Protected routes using conditional rendering or layout routes that
check auth.)
– “What’s new in React Router v6/v7?” (Relative routes,
loader/action patterns, data APIs, simplified nested routing.)
Generated by [Link]
– “What are Compound Components?” (Components that work
together to form a complete UI, like <Select> and <Option>,
sharing state implicitly via Context.)
– “Why have hooks largely replaced HOCs and Render Props?”
(Cleaner code, no wrapper hell, easier composition, no prop
collision.)
• Key subtopics: HOCs (definition, examples like withRouter), Render
Props (children as function), Compound Components (Context-based
implicit state), Control Props pattern, State Reducer pattern, hooks as the
modern replacement.
7.4 React 18+ Concurrent Features
• Explanation: React 18 introduced concurrent rendering, allowing React to
interrupt and resume rendering work. Features include useTransition,
useDeferredValue, startTransition, and Suspense improvements.
Generated by [Link]
• Key subtopics: Concurrent rendering, useTransition,
useDeferredValue, startTransition, priority updates, Suspense
integration, breaking changes (Strict Mode double effects).
7.5 React Server Components (RSC)
• Explanation: Server Components render exclusively on the server. They
can access server-side resources directly (databases, file systems) and
reduce client-side JavaScript. They work alongside Client Components in
frameworks like [Link].
• Why it matters in interviews: This is the future of React architecture.
Senior and staff-level interviews now include RSC questions.
• Common interview questions/traps:
– “Can Server Components use hooks or browser APIs?” (No. They
run on the server and have no access to useState, useEffect,
window, or document.)
Generated by [Link]
Section 8: Interview Mastery — Deep Concepts & Real-World
Scenarios
8.1 React Internals & Fiber
• Explanation: Fiber is React’s reconciliation engine (introduced in React
16). It’s a reimplementation of the stack that enables incremental
rendering, pause/resume, and priority-based updates.
• Why it matters in interviews: Staff+ and core UI engineering roles
expect knowledge of Fiber architecture.
• Common interview questions/traps:
– “What is React Fiber?” (A new reconciliation algorithm and
architecture that breaks rendering work into units, allowing
interruption and prioritization.)
– “What problem did Fiber solve?” (The old stack reconciler couldn’t
interrupt work, causing dropped frames during heavy updates.)
– “What is a work unit in Fiber?” (A small chunk of work that can be
paused, resumed, or abandoned.)
• Key subtopics: Stack reconciler vs. Fiber, work loop, priority levels,
double buffering (current vs. work-in-progress trees), time slicing.
8.2 Strict Mode
• Explanation: Strict Mode is a development-only tool that highlights
potential problems. In React 18, it intentionally double-invokes certain
functions (render, effects, state updaters) to detect side effects.
• Why it matters in interviews: Many “bugs” reported in development are
actually Strict Mode catching impure code. Understanding this prevents
panic.
• Common interview questions/traps:
– “Why does my component render twice?” (React 18 Strict Mode
intentionally double-invokes renders and effects in development to
detect impurity.)
– “Does Strict Mode affect production?” (No. It’s development-only.)
Generated by [Link]
– “What does Strict Mode check?” (Unsafe lifecycles, legacy string
refs, side effects in render, missing keys, deprecated APIs.)
• Key subtopics: Double invocation in development, detecting impure
functions, identifying unsafe patterns, migration aid.
8.3 Testing React Components
• Explanation: React testing involves unit tests for components, hooks, and
integration tests for user flows. Primary tools: React Testing Library (RTL),
Jest, Vitest.
• Why it matters in interviews: Testing philosophy is part of code quality
discussions. Interviewers prefer Testing Library’s “test like a user”
approach.
• Common interview questions/traps:
– “What’s the Testing Library philosophy?” (Test behavior, not
implementation. Query by accessibility roles/labels, not test IDs or
CSS classes.)
– “How do you test a custom hook?” (Use
@testing-library/react-hooks or render a test component that
uses the hook.)
– “What’s the difference between [Link] and
[Link]?” (getBy is synchronous; findBy is async and
waits for the element to appear.)
– “Should you test implementation details?” (No. Testing if a function
was called is fragile. Test what the user sees.)
• Key subtopics: RTL queries (getBy, findBy, queryBy), user events
vs. fireEvent, mocking hooks and context, testing async behavior,
snapshot testing (when appropriate), E2E with Playwright/Cypress.
8.4 TypeScript with React
• Explanation: TypeScript adds static typing to React. Key patterns: typing
props with interfaces, generic components, event types, and hook return
types.
Generated by [Link]
• Why it matters in interviews: Most production React code uses
TypeScript. You must type common patterns confidently.
• Common interview questions/traps:
– “How do you type the children prop?” ([Link] is the
most permissive; [Link] for single elements.)
– “How do you type a generic component?” (function
List<T>({ items }: { items: T[] }) {...})
Generated by [Link]
– “What is dangerouslySetInnerHTML and when is it safe?” (Only
use with sanitized HTML from a trusted source. Never with user
input.)
– “How do you prevent XSS in URLs?” (Validate javascript: URLs
in user-provided links.)
• Key subtopics: JSX escaping, dangerouslySetInnerHTML, URL
validation, CSRF protection (not React-specific but relevant), dependency
vulnerabilities.
8.6 Common Anti-Patterns & Pitfalls
• Explanation: Patterns that seem correct but cause bugs or performance
issues: mutating state, derived state from props without memoization,
inline function definitions in render, overusing useEffect, prop drilling
instead of composition.
• Why it matters in interviews: Recognizing anti-patterns shows maturity.
Interviewers often present code with intentional bugs.
• Common interview questions/traps:
– “What’s wrong with setState({ ...state, count:
[Link] + 1 })?” (Nothing, if state is an object. But if state
is stale due to closures, use functional updates.)
– “Why is useEffect(() => { setState(...) }, []) sometimes
wrong?” (If it depends on props that change, missing dependencies
cause stale closures.)
– “What’s the ‘derived state’ anti-pattern?” (Copying props into state
and trying to keep them in sync. Use fully controlled or fully
uncontrolled with a key.)
– “Why are inline arrow functions in JSX bad?” (They create new
references every render, breaking [Link] child optimizations.)
• Key subtopics: State mutation, stale closures, missing effect
dependencies, derived state, inline functions, over-rendering, useEffect
overuse, key misuse.
Generated by [Link]
Final Interview Checklist
Before walking into any React technical interview, you must be able to explain
confidently:
Foundations
• ☐ What is JSX and how does it compile?
• ☐ The difference between props and state
• ☐ Why props are read-only
• ☐ How state updates trigger re-renders
• ☐ Controlled vs. uncontrolled components
Component Behavior
• ☐ How to handle events and what SyntheticEvent is
• ☐ Conditional rendering patterns and && pitfalls
• ☐ Why keys are critical and what happens with index-as-key
• ☐ Form handling strategies
Data Flow
• ☐ Lifting state up and when to do it
• ☐ Component composition with children and slots
• ☐ Context API: when to use it, when to avoid it, performance implications
• ☐ Prop drilling: problem and solutions
Effects & Lifecycle
• ☐ useEffect dependency array rules and cleanup
• ☐ The difference between useEffect and useLayoutEffect
• ☐ Class component lifecycle methods (for legacy code)
• ☐ Refs: useRef, forwardRef, useImperativeHandle
• ☐ Rules of Hooks and why they exist
Performance
• ☐ Virtual DOM and how it works (accurately, not vaguely)
Generated by [Link]
• ☐ Reconciliation and the diffing algorithm’s assumptions
• ☐ When and how to use [Link], useMemo, useCallback
• ☐ React 18 automatic batching and concurrent rendering basics
• ☐ Render phase vs. commit phase
Modern React
• ☐ Custom hooks: design, rules, and testing
• ☐ Error boundaries: what they catch and what they don’t
• ☐ Code splitting with [Link] and Suspense
• ☐ useTransition, useDeferredValue, and startTransition
• ☐ React Server Components: what they are, what they can/cannot do
Architecture
• ☐ State management tradeoffs (Context vs. Redux vs. Zustand vs. React
Query)
• ☐ Client state vs. server state
• ☐ React Router fundamentals and protected routes
• ☐ HOCs, Render Props, Compound Components (legacy patterns)
• ☐ Component composition over inheritance
Deep Knowledge
• ☐ React Fiber: what problem it solves
• ☐ Strict Mode double invocation in React 18
• ☐ TypeScript patterns for React components
• ☐ React Testing Library philosophy
• ☐ Security: XSS prevention and dangerouslySetInnerHTML
Anti-Patterns
• ☐ State mutation and why it breaks React
• ☐ Stale closures in hooks
• ☐ Missing effect dependencies
• ☐ Derived state from props
Generated by [Link]
• ☐ Inline function references breaking memoization
Study Strategy: Go through this map sequentially. For each topic, be able to
explain it in 60 seconds, write a small code example from memory, and answer
the trap questions listed. If you can’t—study that topic until you can teach it to
someone else.
Generated by [Link]