React Interview Questions and Answers for Freshers
React interviews are mostly about one thing: whether you understand when and why a component re-renders. Every hook question, every performance question and every stale-value bug comes back to it. These are the questions that come up, answered from that angle.
- 23questions
- 2basic
- 13intermediate
- 8advanced
Components, props and state
5 questionsThe opening round, and where the follow-ups start.
Why does React need keys in a list?
What is the virtual DOM and reconciliation?
What is a controlled versus an uncontrolled component?
Why must you never mutate state directly?
setItems([...items, next]).Hooks
6 questionsThe bulk of a modern React interview.
What does useEffect do, and when does it run?
[] only after the first; with dependencies, whenever one of them changes by reference or value. The returned function is cleanup, and it runs before the next effect and on unmount.useEffect(() => {
const id = setInterval(tick, 1000);
return () => clearInterval(id); // cleanup: without this, intervals stack up
}, []);What are the rules of hooks, and why do they exist?
if shifts every later hook by one and state ends up attached to the wrong thing.What is the difference between useMemo and useCallback?
useMemo caches a computed value; useCallback caches a function identity. They exist for two reasons: skipping a genuinely expensive computation, and keeping a stable reference so a memoised child does not re-render. Both cost memory and complexity, so adding them everywhere makes an app slower and harder to read — measure first.When would you use useReducer instead of useState?
What is useRef for?
What causes a stale closure in a hook?
setCount(c => c + 1) — which does not need to read the current value at all.Rendering and performance
4 questionsThe senior-sounding half, and it is all one idea.
What causes a component to re-render?
How would you stop unnecessary re-renders?
React.memo so it only re-renders when props change; keep object and function props stable with useMemo/useCallback, since a fresh object literal each render defeats memo; and move state down so fewer components sit under it.How do you fetch data in React?
What is prop drilling, and how do you avoid it?
Routing, forms and everything else
8 questionsThe questions that map to what you built, not what you read.
How does client-side routing work?
How do you build a form in React?
What is an error boundary?
What is lazy loading, and how do you do it in React?
React.lazy(() => import('./Chart')) with a <Suspense> fallback around it. Route-level splitting is where almost all the benefit is.const Chart = React.lazy(() => import('./Chart'));
<Suspense fallback={<Spinner />}>
<Chart data={data} />
</Suspense>What is a custom hook, and when should you write one?
use that calls other hooks, extracting stateful logic so it can be reused and tested on its own. Write one when the same combination of state and effects appears in two components — useDebounce, useLocalStorage, useFetch. It shares logic, not state: each caller gets its own.How would you test a React component?
What is the difference between server-side rendering and client-side rendering?
How do you manage state that many components need?
Reading answers is not the same as giving them
Most candidates know the material and still stumble when asked out loud. Take a React mock interview where the interviewer follows up on what you actually say.
Other interview question sets
Java
Java interview questions with real answers
JavaScript
JavaScript interview questions with real answers
Python
Python interview questions with real answers
SQL
SQL interview questions with real answers and queries
Spring Boot
Spring Boot interview questions with real answers
DSA
DSA interview questions with real answers
System Design
System design interview questions with real answers