100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
React

Common React Interview Questions

A curated set of frequently asked React interview questions with accurate, in-depth answers.

Interview PrepIntermediate14 min readJul 8, 2026
Analogies

Overview

React interviews typically probe how well you understand the mental model behind the library, not just its API surface. Interviewers want to see that you can explain why the virtual DOM exists, how reconciliation and keys work together, why hooks have rules, and when to reach for memoization or Context instead of prop drilling. This topic collects the questions that come up most often across junior-to-mid React interviews, paired with answers that go a level deeper than a one-line definition so you can defend your reasoning in a follow-up discussion.

🏏

Cricket analogy: A good captain interview isn't about reciting rules, it's explaining why you review a run-out on replay (virtual DOM), why batting order matters for the run chase (reconciliation), and why powerplay fielding restrictions exist (hooks rules).

Frequently Asked Questions

Q: What is the virtual DOM and why does React use it?

The virtual DOM is a lightweight in-memory representation of the real DOM, expressed as plain JavaScript objects. When state changes, React builds a new virtual DOM tree, diffs it against the previous tree (reconciliation), and computes the minimal set of real DOM mutations needed to bring the UI up to date. Direct DOM manipulation is expensive because layout, style recalculation, and repainting are costly browser operations. By batching and minimizing real DOM writes, React trades cheap JavaScript object comparisons for expensive DOM operations, which keeps UI updates fast even as an application grows in complexity.

🏏

Cricket analogy: A scorer keeps a lightweight notebook tally (virtual DOM) and only updates the giant electronic scoreboard (real DOM) with the actual changed digits after comparing the new tally to the old one, since repainting the whole board is slow.

Q: How does React's reconciliation algorithm decide what to re-render?

Reconciliation compares the new element tree to the previous one using a heuristic O(n) diffing algorithm rather than the theoretically optimal O(n^3) tree-diff. It relies on two assumptions: elements of different types produce different trees (so React tears down and rebuilds rather than trying to match children), and elements of the same type are compared attribute-by-attribute while their children are diffed recursively. For lists, React uses the key prop to match children across renders instead of relying on index position, which lets it correctly reorder, insert, or remove items without unnecessarily destroying and recreating DOM nodes and component state.

🏏

Cricket analogy: Reconciliation is like a scorer quickly comparing this over's ball-by-ball log to last over's using a fast heuristic instead of re-checking every possible combination, and using each fielder's jersey number (key) rather than their position on the field to track who's who when the field changes.

Q: Why are keys important in lists, and what happens if you use array index as a key?

Keys give React a stable identity for each item across renders so it can match old elements to new ones instead of guessing by position. A stable, unique key (like a database id) lets React correctly reuse DOM nodes and preserve component state when items are reordered, inserted, or removed. Using the array index as a key works fine for static lists that never reorder or change length, but it becomes a bug source once items can be added, removed, or reordered: React will match the wrong old element to the wrong new data, causing state to attach to the wrong row, stale form inputs, or incorrect animations.

🏏

Cricket analogy: Tracking players by shirt number (stable key) instead of "batting position number" avoids disaster when the order changes mid-innings — using position as identity would wrongly attach one batsman's runs-so-far to whoever now bats at that slot.

Q: What are the Rules of Hooks and why do they exist?

The two rules are: only call hooks at the top level of a function component or custom hook (never inside loops, conditions, or nested functions), and only call hooks from React function components or other custom hooks (never from regular JavaScript functions). These rules exist because React tracks hook state by call order, not by name — internally each component has a linked list of hook calls indexed by position. If a hook is called conditionally, the order can shift between renders, causing React to associate the wrong state or effect with the wrong hook call, leading to subtle and hard-to-debug bugs.

🏏

Cricket analogy: A bowler's over sequence must be fixed and unconditional within the over — you can't skip your third ball only sometimes, because the umpire tracks deliveries strictly by position, and skipping one would misattribute a wide to the wrong ball count.

Q: What is the difference between controlled and uncontrolled components?

A controlled component has its form value driven entirely by React state: the input's value prop is set from state and an onChange handler updates that state on every keystroke, making React the single source of truth. An uncontrolled component lets the DOM manage its own internal state, and React reads the current value on demand via a ref, typically using a defaultValue for the initial value instead of value. Controlled components give you validation, conditional disabling, and formatting on every keystroke at the cost of a re-render per input; uncontrolled components are simpler and more performant for cases like a plain file input or a form you only read on submit.

🏏

Cricket analogy: A controlled scoreboard has every run entered manually into the official ledger the instant it happens (state-driven), while an uncontrolled scoreboard lets the stadium clock run itself and someone just glances at it (ref) when the over ends.

Q: What does the dependency array in useEffect actually do?

The dependency array tells React when to re-run the effect: after the initial render, React re-runs the effect only if any value in the array has changed (compared with Object.is) since the last render. Omitting the array entirely runs the effect after every render; passing an empty array [] runs it once after the initial mount only. A common mistake is omitting a dependency that the effect actually reads, which causes the effect to close over a stale value — the fix is to include every reactive value the effect uses, or to restructure the effect (for example moving logic into the event handler) so it does not need that dependency at all.

🏏

Cricket analogy: A bowling change effect that watches "overs bowled" re-triggers only when that number actually changes; forgetting to watch "pitch condition" too means the captain keeps using stale pitch info from over 5 even at over 30.

Q: What is the difference between useMemo and useCallback?

Both hooks memoize a value between renders based on a dependency array, but they memoize different things: useMemo caches the *result* of an expensive computation and returns that value, while useCallback caches a *function reference* itself, which is really just shorthand for useMemo(() => fn, deps). They're most useful for avoiding expensive recalculations on every render and for keeping stable references so that child components wrapped in React.memo don't re-render just because a new inline function or object was created on the parent. Overusing either adds memory and comparison overhead, so they should be applied where profiling shows a real cost, not by default on every value.

🏏

Cricket analogy: useMemo is like pre-calculating a batsman's strike rate once and reusing it until the innings changes, while useCallback is like keeping the same fixed signal (not re-inventing a new hand gesture each ball) so the fielders (memoized children) recognize it instantly without re-reading it — doing this for every trivial signal wastes the coach's time.

Q: What is prop drilling, and how does Context help?

Prop drilling happens when data needs to pass through several intermediate components that don't use the data themselves, just to reach a deeply nested child — each layer has to accept and forward the prop, which adds boilerplate and coupling. The Context API solves this by letting a provider expose a value at the top of a subtree that any descendant can read directly via useContext, skipping the intermediate layers entirely. Context isn't a full replacement for state management libraries, though: every consumer re-renders when the context value changes, so it's best for relatively low-frequency, broadly-shared data like theme, locale, or authenticated user, rather than high-frequency state.

🏏

Cricket analogy: Instead of relaying the national anthem schedule through every team official down the line, the stadium PA system (Context provider) broadcasts it once so any player can tune in directly — but broadcasting every single run update this way would make every player react to noise; it's best for slow-changing info like the toss result, not ball-by-ball scores.

Q: What is the difference between state and props?

Props are read-only inputs passed down from a parent component to configure a child; a component must never mutate its own props. State is data owned and managed internally by a component (via useState or useReducer) that can change over time and triggers a re-render when updated. The distinction matters for data flow: props flow one way, top-down, while state changes are local and, if a descendant needs to affect an ancestor, are handled by passing a callback down as a prop ("lifting state up") rather than mutating a prop directly.

🏏

Cricket analogy: The batting order (props) is set by the captain and a batsman can't rewrite it, but a batsman's own running tally of runs today (state) is his to update each ball — if he wants the captain to promote him, he signals the captain (lifting state up) rather than editing the order sheet himself.

Q: What are error boundaries and what can't they catch?

Error boundaries are class components that implement static getDerivedStateFromError and/or componentDidCatch to catch JavaScript errors thrown during rendering, in lifecycle methods, and in constructors of their child tree, displaying a fallback UI instead of crashing the whole app. They do not catch errors inside event handlers (those need a regular try/catch), errors in asynchronous code such as setTimeout or promise callbacks, errors during server-side rendering, or errors thrown in the error boundary itself. There is currently no hook-based equivalent, so error boundaries must still be written as class components, though libraries like react-error-boundary wrap this pattern for convenience.

🏏

Cricket analogy: A backup umpire (error boundary) steps in only when the on-field umpire makes a decision-review error during play, but can't help if a player gets injured off the field during a press conference (event handler) or during team selection meetings before the match (async/SSR); there's no substitute for the backup umpire role itself.

Quick Reference

  • Virtual DOM: in-memory tree diffed against the previous render to compute minimal real DOM updates.
  • Reconciliation assumes different element types produce different trees and uses keys to match list items.
  • Rules of Hooks: top-level calls only, and only from React functions, because hook order must stay stable.
  • Controlled components: value lives in React state; uncontrolled components: value lives in the DOM, read via ref.
  • useEffect's dependency array controls when the effect re-runs; missing dependencies cause stale closures.
  • useMemo memoizes a computed value; useCallback memoizes a function reference.
  • Context avoids prop drilling but re-renders all consumers when its value changes.
  • Props are read-only and flow down; state is local and mutable via setters.
  • Error boundaries catch render/lifecycle errors in children, not event handler or async errors.
  • React batches state updates inside event handlers (and, since React 18, in most async contexts too) to avoid redundant renders.

Key Takeaways

  • Be ready to explain the 'why' behind React concepts, not just recite definitions.
  • Keys and dependency arrays are two of the most commonly misunderstood — and most commonly tested — topics.
  • Know the tradeoffs of Context versus dedicated state management before recommending either.
  • Understand what error boundaries cover and, just as importantly, what they don't.
  • Practice explaining answers out loud; interviewers weigh clarity of reasoning as much as correctness.

Practice what you learned

Was this page helpful?

Topics covered

#React#ReactJsStudyNotes#WebDevelopment#CommonReactInterviewQuestions#Common#Interview#Questions#Frequently#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse