Advanced React.
js Viva Questions with Answers
1. What is React Fiber?
Answer: React Fiber is the new reconciliation engine in React 16+. It improves scheduling and performance
by breaking rendering work into units and prioritizing updates.
2. How does React achieve high performance?
Answer: React uses the Virtual DOM, efficient diffing algorithms, and batching of updates. It avoids direct
DOM manipulations and re-renders only changed components.
3. Explain Concurrent Mode in React.
Answer: Concurrent Mode enables React to interrupt rendering work to focus on more urgent updates. It
allows for smoother rendering and better user experience.
4. What is the difference between useMemo and useCallback?
Answer: useMemo memoizes a computed value, while useCallback memoizes a function definition. Both help
in preventing unnecessary re-renders.
5. What are Suspense and lazy in React?
Answer: React.lazy allows for dynamic import of components. Suspense lets you show fallback UI (like a
loader) while waiting for components to load.
6. How does the React Context API work internally?
Answer: Context uses a Provider to pass values down the tree and Consumers or useContext to access
them. React tracks context usage and re-renders consumers when the value changes.
7. What is a custom hook and why use it?
Advanced React.js Viva Questions with Answers
Answer: A custom hook is a reusable JavaScript function that can use React hooks. It helps in abstracting
and sharing logic between components.
8. Explain the lifecycle of a React component in functional components using hooks.
Answer: Mounting: useEffect(() => {...}, []), Updating: useEffect with dependencies, Unmounting: return () =>
cleanup inside useEffect.
9. How do you handle performance bottlenecks in React?
Answer: Use React.memo, useCallback, useMemo, avoid unnecessary state, lazy load components, and split
large components.
10. What is reconciliation in React?
Answer: Reconciliation is the process by which React updates the DOM by comparing the new virtual DOM
with the previous one and applying only the differences.