🔍 13 Frontend Interview Questions for Full-Stack Developers
JS Enthusiast
1. How Does the Browser Render a Webpage?
The Critical Rendering Path:
HTML is parsed into a DOM
CSS is parsed into a CSSOM
Render Tree = DOM + CSSOM
Layout: computes geometry
Paint: pixels drawn
Compositing: layers combined
Optimize this path by deferring non-critical resources and minimizing blocking scripts.
2. What Is Event Delegation?
Instead of attaching listeners to many child elements, we attach one listener to a common parent and use event.target to determine the source.
Why it's powerful:
Works for dynamic content
Fewer listeners = better performance
3. How Does React’s Reconciliation Work?
React builds a new virtual DOM tree on every state/prop update, then diffs it with the previous one.
Only the minimal required DOM mutations are applied
keyprops are crucial for efficient list diffs
4. Controlled vs Uncontrolled Components in React
Controlled: React state owns the input (
value,onChange)Uncontrolled: DOM manages the state (
refaccess)
Controlled components offer better control and testability — ideal for validations and conditionals.
5. How Do You Handle Async Data in React?
Typical pattern:
Use
useEffectto trigger fetchMaintain states:
loading,error,dataAvoid memory leaks via abort signals or
isMountedchecksConsider
React Queryfor caching, retries, and background updates
6. == vs === in JavaScript
==performs type coercion (e.g.,"5" == 5→ true)===is strict (no coercion)
Use
===by default to avoid bugs.
7. What Is a Closure?
A closure is a function that remembers variables from its lexical scope, even after that scope has exited.
function counter() {
let count = 0;
return () => ++count;
}
const inc = counter();
inc(); // 1
Used in debouncing, memoization, and encapsulating private state.
8. What Causes React Re-renders?
State or props change
Context update
Avoid unnecessary renders with:
React.memouseMemo,useCallbackGuarding against setting identical state
9. How Do You Optimize Frontend Performance?
Lazy-load images & components
Code-split using
React.lazyorimport()Use CDN for static assets
Minify + compress JS/CSS
Memoize expensive computations
10. What Are Common Frontend Security Concerns?
XSS: escape HTML, use
dangerouslySetInnerHTMLsparinglyCSRF: use
SameSitecookies, CSRF tokensAvoid exposing secrets in client code
Always validate inputs both client and server-side
11. Best Practices for API Integration in React
Use
fetchor Axios with async/awaitModel
loading,error,dataexplicitlyUse HTTP status codes meaningfully
Handle pagination, retries, token expiry
12. How Does useEffect Work with Dependencies?
Triggers when any dependency changes
Common mistakes:
Omitting deps → stale values
Including unstable functions → infinite loops
Use
useCallbackoruseRefto stabilize dependencies when needed.
13. Can You Write a Debounce Function?
Yes. Used to throttle rapid events like keystrokes or window resize:
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
Final Thoughts
In under 35 minutes, these questions let you gauge:
JavaScript depth
React fluency
Async thinking
Performance awareness
Real-world readiness
Even backend-heavy candidates should be able to reason through most of these. If they can’t — they're not ready to ship modern web UIs. If they can — you’ve got a true full-stack asset.

