Senior React Developer Interview Questions

Common senior React interview questions with short answers.

When interviewing for a senior React role you're expected to know more than the hooks API. Interviewers want to hear how React works and when you'd pick one approach over another. Here are the questions I see most.

How does reconciliation work and why do keys matter?

When state changes, React renders a new tree and compares it to the previous one to work out the smallest set of DOM updates. In a list, key is how React matches items between renders. Using the array index as a key breaks when items are reordered or removed, because state ends up attached to the wrong item.

// Use a stable id from your data, not the index
<ul>
{todos.map((todo) => (
<Todo key={todo.id} todo={todo} />
))}
</ul>

When does a component re-render?

A component re-renders when its state changes, when its parent re-renders, or when a context it uses changes. Props changing is not the trigger on its own. A child re-renders with its parent by default, even if its props are the same.

When should you use useMemo, useCallback and React.memo?

React.memo skips re-rendering a component when its props are shallowly equal. useMemo and useCallback keep a value or function reference stable between renders so that comparison can work.

const List = React.memo(function List({ items, onSelect }) {
return items.map((item) => (
<button key={item.id} onClick={() => onSelect(item.id)}>
{item.name}
</button>
))
})
function Page({ items, query }) {
const filtered = useMemo(
() => items.filter((item) => item.name.includes(query)),
[items, query]
)
const handleSelect = useCallback((id) => console.log(id), [])
return <List items={filtered} onSelect={handleSelect} />
}

The senior answer is knowing when not to use them. Memoization has a cost, and wrapping everything makes code harder to read. Reach for it when you've measured a slow render with the React DevTools Profiler, or when a value is a dependency of another hook.

What are the common useEffect pitfalls?

Missing dependencies give you stale values. Objects and functions created during render are new every time, so effects that depend on them run on every render. And forgetting to clean up leaves subscriptions and requests running after the component unmounts.

useEffect(() => {
const controller = new AbortController()
fetch(`/api/users/${userId}`, { signal: controller.signal })
.then((res) => res.json())
.then(setUser)
.catch(() => {})
return () => controller.abort()
}, [userId])

In development, Strict Mode mounts, unmounts and mounts every component again, so effects run twice. That's on purpose. It surfaces effects that don't clean up properly. Also ask whether you need an effect at all. Values you can calculate from props or state should be calculated during render.

What's the difference between controlled and uncontrolled inputs?

A controlled input gets its value from React state and updates through onChange. An uncontrolled input keeps its own value in the DOM and you read it with a ref or from the form when it's submitted.

function ControlledEmail() {
const [email, setEmail] = useState("")
return <input value={email} onChange={(e) => setEmail(e.target.value)} />
}
function UncontrolledEmail() {
const inputRef = useRef(null)
const handleSubmit = (e) => {
e.preventDefault()
console.log(inputRef.current.value)
}
return (
<form onSubmit={handleSubmit}>
<input defaultValue="" ref={inputRef} />
</form>
)
}

Controlled inputs are easier to validate as the user types. Uncontrolled inputs re-render less, which is why React Hook Form leans on them.

When do you lift state, use context or use a store?

Start with local state. Lift it to the closest common parent when siblings need it. Use context for values that many components read but that rarely change, like the theme or the current user. Every consumer re-renders when the context value changes, so for state that updates often and is used across the app, a store like Zustand or Redux Toolkit with selectors is a better fit. Server data belongs in something like TanStack Query rather than global state.

When would you use useReducer?

When state has several related values or the next state depends on the previous one in non-trivial ways. The update logic moves into a pure function that's easy to test. I cover it in How to use the useReducer hook in React.

What are useTransition and useDeferredValue?

They're part of the concurrent features in React 18. Both let you mark some updates as non-urgent so typing and clicking stay responsive while React renders the heavy part in the background.

function Search({ items }) {
const [query, setQuery] = useState("")
const deferredQuery = useDeferredValue(query)
return (
<>
<input value={query} onChange={(e) => setQuery(e.target.value)} />
<SlowResults items={items} query={deferredQuery} />
</>
)
}

useTransition does the same by wrapping a state update you own in startTransition.

How do Suspense and lazy loading work?

React.lazy splits a component into its own bundle and loads it on first render. Suspense shows a fallback while it loads.

const Settings = lazy(() => import("./Settings"))
function App() {
return (
<Suspense fallback={<Spinner />}>
<Settings />
</Suspense>
)
}

What are Server Components?

In the Next.js App Router, components are Server Components by default. They render on the server, can be async and read data directly, and send no JavaScript for themselves to the browser. Anything that needs state, effects or event handlers has to be a Client Component, marked with "use client" at the top of the file.

// app/users/page.js (Server Component)
import LikeButton from "./LikeButton"
export default async function UsersPage() {
const users = await db.user.findMany()
return users.map((user) => (
<div key={user.id}>
{user.name} <LikeButton userId={user.id} />
</div>
))
}
// app/users/LikeButton.js
"use client"
import { useState } from "react"
export default function LikeButton({ userId }) {
const [liked, setLiked] = useState(false)
return (
<button onClick={() => setLiked(!liked)}>{liked ? "Liked" : "Like"}</button>
)
}

Push "use client" as far down the tree as you can, and remember that props passed from server to client components must be serializable.

Why write custom hooks?

Custom hooks let you share stateful logic, not state. Each component that calls the hook gets its own copy.

function useToggle(initial = false) {
const [on, setOn] = useState(initial)
const toggle = useCallback(() => setOn((value) => !value), [])
return [on, toggle]
}
const [isOpen, toggleOpen] = useToggle()

How do you handle errors while rendering?

With an error boundary. There's still no hook for this, so it has to be a class component (or the react-error-boundary package).

class ErrorBoundary extends React.Component {
state = { hasError: false }
static getDerivedStateFromError() {
return { hasError: true }
}
componentDidCatch(error, info) {
logError(error, info.componentStack)
}
render() {
if (this.state.hasError) return this.props.fallback
return this.props.children
}
}

Error boundaries don't catch errors in event handlers or async code. Use try...catch there.

How do you make React components accessible?

Use semantic HTML first: a <button> instead of a clickable <div>, labels on inputs, and real headings. Manage focus when content appears or disappears, and make sure everything works with a keyboard. I walk through a full example in Building an Accessible Dropdown Menu in React.

As with most senior interviews, explaining why you'd choose one approach over another matters more than the exact API.

Have some feedback on this post? .