React.js Interview Questions & Answers
Comprehensive collection of 200+ ReactJS interview questions and answers. Master React 18 & 19, Fiber Architecture, Hooks, Concurrent Mode, and State Management.
Difficulty Filters
Tools & Options
What is React?
React is a JavaScript library for building user interfaces, primarily for single-page applications. It's used for handling the view layer for web and mobile apps.
What is JSX?
JSX stands for JavaScript XML. It allows us to write HTML elements in JavaScript and place them in the DOM without any createElement() or appendChild() methods.
What are the core features of React?
Core features include Virtual DOM, JSX, Components, One-way data binding, and Simplicity (easy to learn and use).
What is the Virtual DOM?
What are Components in React?
Difference between Functional and Class Components?
What are Props?
What is State?
What is the use of 'key' prop in lists?
What is useState hook?
What is useEffect hook?
Explain One-way Data Binding.
What is a Single Page Application (SPA)?
How do you handle events in React?
What is Conditional Rendering?
What is a React Fragment?
What is 'create-react-app'?
How do you add styles in React?
What is the 'children' prop?
What is the significance of 'className'?
What are Hook rules?
Difference between React and Angular?
What is an event pooling?
How to pass data from child to parent?
What is the default port for React local server?
What is the purpose of 'export default'?
How to update state based on previous state?
What is a Pure Component?
What is the use of 'npm' in React?
What is 'strict mode' in React?
What is ReactDOM?
How to comment in JSX?
What are Synthetic Events?
What is a Controlled Input?
What is an Uncontrolled Input?
What is the difference between HTML and React events?
What is Babel?
What is Webpack?
How to prevent a component from rendering?
What is 'prop-types'?
Difference between UI and Logic?
What is a higher-order component (basic)?
What is the role of 'package.json'?
How to handle forms in React?
What is an Array Map in React?
What is 'destructuring' in React?
What is React.memo()?
Importance of 'useEffect' dependency array?
How to navigate between pages (basic)?
What is the 'public' folder for?
Explain the Context API in detail.
When to use useMemo vs useCallback?
How do you optimize React performance?
What are React Portals?
Explain Error Boundaries.
How to handle global state without Redux?
What is useReducer hook?
Explain 'lifting state up'.
What are custom hooks?
Difference between useMemo and React.memo?
Explain forwardRef.
What is useRef and its common use cases?
Explain React Router v6 features.
How to fetch data in useEffect properly?
What is the use of Layout components?
How to implement Protected Routes?
Difference between server-side and client-side routing?
How to use the useContext hook?
What is 'Prop Drilling' and how to avoid it?
Explain the concept of 'Render Props'.
What is the difference between useLayoutEffect and useEffect?
How to optimize images in React?
What is Dependency Injection in React?
Explain React's 'Reconciliation'.
How to debug React applications?
What is the 'key' warning in console?
How to handle large forms in React?
What is the Virtual DOM's 'Diffing' algorithm?
Explain state persistence (localStorage) in React.
What are Higher-Order Components (HOC) examples?
How to handle API errors globally?
Difference between Shadow DOM and Virtual DOM?
What is React.lazy and Suspense?
What are fragments shorthand issues?
How to use useImperativeHandle?
What is the importance of 'cleanup function' in useEffect?
How to fetch data derived from multiple state changes?
Explain component composition vs inheritance.
What is the 'batching' of updates?
How to test components thoroughly?
What is 'shallow rendering' in tests?
How to handle accessibility (A11y) in React?
What is 'Hydration' in React?
How to manage theme (Dark/Light) in React?
What is the use of 'debugger;' statement?
How to fix 'Maximum update depth exceeded' error?
Explain the 'module' pattern in React project structure.
How to use 'URL Search Params' in React?
What is React's Concurrent Mode?
How to use SVGs effectively in React?
What is the React Fiber architecture?
Explain SSR, SSG, and ISR in Next.js.
How do you implement Micro-frontends with React?
Explain the 'useTransition' hook.
What is the 'useDeferredValue' hook?
How to handle memory leaks in large applications?
Deep dive: Reconciliation and Diffing logic.
Redux Saga vs Redux Thunk.
Explain Server Components in React 18.
What is 'Atomic State Management' (Recoil/Jotai)?
How to implement Custom Middleware in Redux?
Web Workers integration with React.
Security best practices: XSS and Data Sanitization.
Explain the 'Double Invoke' in StrictMode.
What is 'Zustand' and why is it popular?
Optimizing Web Vitals in a React app.
Explain 'Code Splitting' beyond React.lazy.
How does the 'useSyncExternalStore' hook work?
Using 'useId' for unique identifiers.
Explain 'Automatic Batching' in React 18.
What is 'Tree Shaking'?
Implementing complex animations (e.g., Framer Motion).
Testing Hooks with renderHook.
How to handle 'Hydration Mismatch'?
Explain 'Streaming SSR'.
What are 'Ref' utility patterns (e.g., Callback Refs)?
Architecture: Feature-Slicing Design (FSD).
How to implement Multi-language (i18n) at scale?
Security: JWT storage (Cookie vs LocalStorage).
Explain 'Module Federation' in depth.
Performance: Virtualization (react-window).
What is 'useInsertionEffect'?
How to build a Design System with React?
Handling Cross-tab Communication.
Explain 'Command Pattern' in React.
What is 'Preact' and when to use it?
What is 'TanStack Query' (React Query)?
Explain 'Finite State Machines' with XState.
Advanced usage of useReducer with Middleware.
How to scale React applications for millions of users?
What are 'React Native' differences?
Explain 'Reflecting' state to URL.
How to optimize Context API re-renders?
What is 'Experimental React' branch?
Handling File Uploads at scale.
What is 'Isomorphic JavaScript'?
Explain 'Duck Pattern' in Redux.
Using 'Proxy' for state management.
What is 'Shadowing' in Gatsby/Next.js?
Future of React: What's after React 18/19?
How to implement a useLocalStorage hook?
Reverse a string in JavaScript without built-in 'reverse'?
Implement a simple counter with useReducer.
How to debounce a function in React?
Find the longest word in a sentence.
Remove duplicates from an array.
Implement a deep clone function.
Check if a string is a palindrome.
Convert a nested object to a flat URL query string.
Flatten a nested array.
Count character occurrences in a string.
Group an array of objects by a property.
Implement a basic Fetch with error handling.
Create a simple Toggle hook.
Find the intersection of two arrays.
Sum of all numbers in an array.
Implement a 'usePrevious' hook.
How to throttle a function?
Check if two arrays are equal.
Merge two sorted arrays efficiently.
Implement Fibonacci sequence (recursive).
FizzBuzz implementation in JS.
Detecting Prime numbers.
Capitalize the first letter of each word.
Find the missing number in an array (1 to N).
How to handle infinite scrolling?
Creating a controlled vs uncontrolled component (Code).
Using 'useMemo' for expensive sorting.
Generating a random color in JS.
Implementing a Countdown Timer.
Finding duplicate numbers in an array.
How to use 'useCallback' to prevent unnecessary child renders?
Convert snake_case to camelCase.
Implement a simple Pub/Sub pattern.
Extract numeric values from a string.
Calculating Factorial (Iterative).
Using 'useId' for accessible labels (Code).
How to prevent memory leaks with AbortController?
Find the second largest number in an array.
Implementing a 'useWindowSize' hook.
Deep merge two objects.
Fetch multiple URLs concurrently.
Shuffle an array randomly.
Removing specific value from array.
Implement a 'useUpdateEffect' hook.
Checking for empty object.
Calculating average of array numbers.
Generating UUID v4 in JS.
Creating a custom context provider wrapper.
Handling Form Data easily with JavaScript.
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
