React Interview Questions for 3 Years Experience (With Answers)
If you have around 3 years of React experience, interviewers usually stop asking basic “What is React?” questions and focus more on performance, hooks, Redux, rendering, optimization, and real-world scenarios.
In this blog, I’ll share commonly asked React interview questions for experienced developers along with practical answers.
1. What is the difference between Virtual DOM and Real DOM?
The Real DOM directly updates the webpage whenever changes happen, which can be expensive.
The Virtual DOM is a lightweight copy of the Real DOM. React compares the previous Virtual DOM with the new one using a process called diffing, and only updates the changed parts.
Example:
If a page has 100 components and only 1 changes:
- Normal DOM → may re-render more elements
- React Virtual DOM → updates only the changed component
This improves performance.
2. What is React Fiber?
Many developers say:
“React uses Virtual DOM.”
That is true, but modern React internally uses Fiber architecture.
Fiber helps React:
- Pause rendering
- Prioritize important updates
- Improve UI responsiveness
For example:
Typing in a textbox should feel fast even if a huge list is rendering.
React Fiber makes this possible.
3. Explain useMemo vs useCallback
This question is very common for experienced React developers.
useMemo
Used to memoize a calculated value.
const total = useMemo(() => {
return items.reduce((a, b) => a + b.price, 0);
}, [items]);
Use this when calculations are expensive.
useCallback
Used to memoize a function.
const handleClick = useCallback(() => {
console.log("clicked");
}, []);
This prevents unnecessary function recreation.
Simple Difference:
-
useMemo→ remembers a value -
useCallback→ remembers a function
4. Difference between useEffect and useLayoutEffect
useEffect
Runs after the screen updates.
Used for:
- API calls
- Event listeners
- Timers
useLayoutEffect
Runs before browser paint.
Used when:
- Measuring DOM
- Preventing flickering UI
Most applications mainly use useEffect.
5. What is Prop Drilling?
Prop drilling happens when props are passed through multiple components unnecessarily.
Example:
App
↓
Parent
↓
Child
↓
GrandChild
If only GrandChild needs data, passing props through all levels becomes messy.
Solution:
- Context API
- Redux
- Zustand
6. What is Redux Saga?
Redux Saga is middleware used for handling side effects such as:
- API calls
- Delays
- Async operations
It uses generator functions.
Example:
function* fetchUserSaga() {
const data = yield call(api.getUser);
yield put(setUser(data));
}
Common effects:
-
takeEvery -
takeLatest -
put -
call
7. Difference Between display: none and visibility: hidden
display: none
- Removes element from layout
- Takes no space
visibility: hidden
- Element hidden
- Still occupies space
This is frequently asked in frontend interviews.
8. What is Closure in JavaScript?
Closure happens when an inner function remembers variables from the outer function even after execution.
Example:
function counter() {
let count = 0;
return function () {
count++;
console.log(count);
};
}
const increment = counter();
increment(); // 1
increment(); // 2
The inner function remembers count.
Final Thoughts
For a React developer with around 3 years of experience, focus less on definitions and more on:
- Performance optimization
- Hooks
- Rendering behavior
- State management
- Real-world debugging scenarios
Interviewers care more about:
“How did you solve problems in your project?”
rather than textbook definitions.
If you prepare the topics above well, you’ll already be ahead of many candidates.
Comments
Post a Comment