What is the difference between useEffect and useLayoutEffect?
useEffect runs asynchronously after the browser paints — used for data fetching, subscriptions, and side effects that don't need to block rendering. useLayoutEffect runs synchronously after DOM mutations but before browser paint — use only when you need to measure DOM elements or apply CSS changes that would cause visible flicker. In most cases, useEffect is correct. useLayoutEffect is for rare cases like tooltip positioning.
How does React reconciliation work?
Reconciliation is React's algorithm to determine what changed between renders and update only the necessary DOM nodes. React compares virtual DOM trees using the diffing algorithm: (1) Elements of different types → rebuild entire subtree, (2) Elements of same type → update attributes, (3) Lists → use key prop to identify which items moved/added/removed. Always provide stable, unique keys for list items — using index as key breaks reordering.
Know your weak spots before the interview
10-question AI readiness assessment → personalized study plan.
Take Free Assessment →Unlock 3,000+ Interview Questions
Get full access to all interview questions with detailed answers, explanations, and real company context
Unlock Full Access →