The Front End Interview Handbook – 2027

If you’ve landed on this platform, there’s a good chance you have a front-end interview coming up, or you’re thinking about diving into the interview process and have been bouncing around the internet looking for some structured guidance and resources. This front end interview handbook is that guidance in one place.
Unlike traditional software engineering interviews that lean heavily on Leetcode-style algorithm problems, front-end interviews are a different beast altogether.
You might be asked domain-specific questions, such as how the CSS box model works or the role of semantic HTML, or be asked to build a small React app that fetches data. At the same time, you could just as easily be asked to reverse a linked list, invert a binary tree, or design a full-scale frontend system. In short, anything’s fair game, and that unpredictability can be overwhelming.
Our Purpose With This Front End Interview Handbook
This platform was created to provide engineers with a structured, no-nonsense roadmap for navigating the front-end interview process.
I’ve personally conducted hundreds of front-end interviews for top tech companies and been on the other side of the table interviewing for roles myself. Additionally, the FrontendLead community contains thousands of engineers who have shared their interview experiences, patterns, and preparation strategies.
This handbook is built from all of that collective insight. Whether you’re a new grad, a mid-level engineer looking to level up, or a principal preparing for senior loops, this guide is here to help you walk into interviews with clarity and confidence.
Is This Handbook Right for You?
The Frontend Interview Handbook is designed to help existing frontend engineers (whether you are a new grad or a principal engineer) prepare for frontend interviews. So, you are expected to have some experience in frontend engineering.
Before jumping into interview preparation, it is essential to be familiar with the core building blocks of frontend development.
Here’s a quick checklist of what you’re expected to know walking in:
| Category | What You Should Know |
|---|---|
| HTML | Basic understanding html tags like <p> <div> <section>How HTML layout works Attributes like id, class, alt, href, and custom data attributes |
| CSS | Basic alignment items using Flexbox and Grid Casic styling elements using CSS |
| JavaScript | Basic knowledge of writing functions and using variables Basic understanding of DOM manipulation and event handling Nice to have: standard array methods like map filter reduceNice to have: working with async code using Promises and async/await |
| React | Basic React knowledge, building functional components Using hooks like useState and useEffectUnderstanding props, state, and component hierarchy Basic JSX and component composition |
Consider this example:
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
const increment = () => {
setCount(count + 1);
};
return (
<div style={{ textAlign: 'center', padding: '2rem' }}>
<h1 style={{ fontSize: '2rem', color: '#333' }}>
Count: {count}
</h1>
<button
onClick={increment}
style={{
padding: '0.5rem 1rem',
fontSize: '1rem',
backgroundColor: '#007bff',
color: '#fff',
border: 'none',
borderRadius: '4px',
cursor: 'pointer'
}}
>
Increment
</button>
</div>
);
}
export default Counter;
Quiz yourself on the example above: Do you understand this code? If the answer is no, don’t worry – we’ve got you covered with free beginner guides to learn HTML, CSS, JavaScript, React JS, and Data Structures and Algorithms knowledge required for Frontend Interviews.
Otherwise, you are ready to continue preparing using the Front-End Interview Handbook.
Table of Contents
- Overview
- Fundamental Knowlege
- Frontend Interview Playbook
- Frontend Interview Process Explained
- Frontend Interview Question Type by Company
- Recommended Study Plan
- HTML Interview Questions & Answers
- CSS Interview Questions & Answers
- JavaScript Interview Questions & Answers
- React JS Interview Questions & Answers
- Frontend Trivia Questions & Answers
- Build a Small Frontend App: Style Questions & Answers
- Frontend System Design Questions
- Design Patterns in React
- Behavioral Questions & Answers
- Salary Negotiation
- How to not screw up the negotiation
What does a frontend engineer do?

Front-end engineers, also known as front-end developers, create the visual elements of an app or website. They design the user-facing content that users see and interact with.
They’re the ones behind the layout of a landing page, the feel of a button when you hover over it, and how smoothly a mobile nav menu slides open. Their work is where code meets design. It’s about making things look good, feel good, and work.
Do you need a degree in computer science?
Not at all.
Many frontend engineers come from traditional computer science backgrounds, but just as many do not. Some started in design, others in teaching, marketing, or completely unrelated fields. Many of them either taught themselves or acquired skills through coding boot camps.
The one thing they all have in common is this: they built projects. They got their hands dirty. In frontend, what matters is your ability to ship clean, usable interfaces, not where you went to school.
The core tools you’ll use
Most frontend engineers today work with React, a JavaScript framework that enables the easy development of fast and interactive web applications. It is especially common at more prominent tech companies.
But not everyone uses React. At smaller companies or in older codebases, you might run into Angular, jQuery, or even plain HTML, CSS, and JavaScript.
That’s why the fundamental foundation for any frontend engineer is what I call the three sacred tools:
-
HTML for structure
-
CSS for styling
-
JavaScript for interactivity
Frameworks come and go. These three never change.
What are the differences between the frontend and the backend?
| Frontend Engineer | Common Skills | Backend Engineer |
|---|---|---|
| Builds user interfaces with HTML, CSS, JavaScript, and React | Writes clean, maintainable, and testable code | Builds scalable APIs and services using Node.js, Go, Java, or Python |
| Focuses on responsive design and performance | Understands computer science fundamentals (DS & Algos) | Optimizes database queries and system performance |
| Implements animations, state management, and accessibility | Uses Git and CI/CD pipelines | Handles authentication, authorization, and data security |
| Works closely with design and product teams | Participates in code reviews and architecture discussions | Integrates third-party APIs and manages cloud services |
| Uses browser dev tools and performance profiling | Follows Agile or Scrum development processes | Monitors and logs backend errors and metrics |
Frontend engineers build everything the user sees and touches. Backend engineers build what powers all of that behind the scenes.
A frontend engineer might build the form. A backend engineer handles what happens after you submit it.
Frontend is about layout, responsiveness, polish, and design systems. Backend is about databases, APIs, infrastructure, and data flow.
They both require strong problem-solving skills, but the flavor of those problems is different. Frontend is about the user experience. Backend is about what happens under the hood.
Is frontend engineering right for you?
If you’ve got a creative eye and enjoy design as much as development, frontend might be your sweet spot.
Frontend is an excellent fit for people who care about visual detail and want to build things that users see. It’s the part of software engineering where creativity and logic go hand in hand.
You might love frontend if you:
-
Enjoy making things look polished and beautiful
-
Like tweaking UI components until they feel just right
-
Find joy in responsive design and animations
-
Prefer working closely with design teams
Compared to the backend, which is often more data-heavy and logic-focused, the frontend gives you a bit more room to express your design sense while still solving challenging technical problems.
Next, let’s discuss the earnings of frontend engineers.
Front End Engineer Salary in the United States 2025

For front-end developers in the United States, the compensation varies based on experience, location, and the specific company.
Generally speaking, if you live in a tech hub, such as San Francisco, Seattle, or New York, your salary as a software engineer (frontend) will include:
- Base salary
- Stock options
- Possible signing bonus
- Possible relocation bonus
- Other company perks (free lunches, 401k match, etc..)
Here are some key salary metrics (base salary only):
- Median Salary: Typically around $153,000 per year, indicating that half of all front-end developers earn more than this amount, and half earn less (levels.fyi).
- High Salary: Salaries can reach as high as $210,000 per year for top earners in specific regions or with extensive experience (levels.fyi).
- Top 1% Salary: At the 90th percentile, you can expect to earn as much as $270,000 per year (levels.fyi).
Stock Options
Stock options are a common component of compensation packages in tech companies, particularly in startups and large, publicly traded tech firms. The value of stock options can vary greatly:
- Startups might offer stock options that could be highly lucrative if the company goes public or is acquired.
- Established companies, such as those in the FAANG (Facebook, Apple, Amazon, Netflix, Google) group, typically provide RSUs (Restricted Stock Units) as part of their compensation packages. The value can range from $50,000 to over $200,000 annually, depending on the company’s stock performance and the seniority of the position.
Signing Bonuses
Signing bonuses are used to attract top talent and can make a significant impact on the total compensation package:
- For front-end developers, especially in competitive markets like San Francisco or New York, signing bonuses can range from $15,000 to $60,000.
- Higher bonuses are often offered to more experienced developers or those joining senior roles.
Relocation Bonuses
Relocation bonuses are provided when candidates need to move geographically to take up the new role. This type of bonus covers moving expenses and can range:
- From $5,000 for moves within the same region to upwards of $20,000 for international relocations, depending on the distance and the company’s policies.
Other Perks
Tech companies are also famous for their generous perks, which can enhance the overall value of working with them:
- Health Benefits: Comprehensive health, dental, and vision insurance, which often covers dependents at a minimal cost.
- Retirement Plans: Contributions to 401(k) plans with company match, which can range from 3% to 6% of annual salary, sometimes even higher.
- Wellness Programs: Subsidies for fitness memberships and wellness programs.
- Education and Training: Budgets for professional development, courses, and conferences.
- Food and Meals: Free meals, snacks, and beverages on-site.
- Transportation: Shuttle services or reimbursement for transportation expenses.
- Work-from-Home Stipends: Especially relevant in the post-COVID era, companies may offer stipends to help set up a home office.
Total Compensation
When you add up the base salary, stock options, bonuses, and perks, the total annual compensation for a front-end developer in a tech hub can easily exceed the base salary by a significant margin. For example, a front-end developer with a base salary of $150,000 could realistically expect total compensation to exceed $250,000, including stock options and bonuses.
Understanding these components helps to evaluate job offers comprehensively and recognize the full potential of a tech career in terms of financial rewards and lifestyle benefits. This holistic view of compensation is crucial for both job seekers in the tech industry and those looking to advance in their current roles.
Next, let’s examine the frontend interview process and how it operates.
The Frontend Interview Process Explained
If you’re applying for frontend roles, especially at mid to large tech companies, the interview process tends to follow a predictable structure. Once you understand how it’s designed and what each round is testing, it becomes a lot easier to prep intentionally instead of randomly grinding Leetcode.
Here is a high-level representation of the average frontend interview process:

Let’s walk through the process using the exact flow most companies follow, from recruiter screen to final offer.
1. Recruiter Screen
This is your first point of contact. It’s not technical (for the most part, Meta recruiters quiz frontend trivia questions).
The recruiter wants to confirm a few basics:
-
Are you actively looking?
-
Do you meet the minimum role requirements?
-
What’s your timeline and salary expectations?
This round is all about communication and clarity. Be honest, concise, and make it easy for them to move you to the next step.
2. Phone Screen or Take-Home Test
After the recruiter screen, companies usually go one of two ways depending on the size and structure of their team:
Option A: Take-Home Test (common in startups and mid-size companies)
You’ll be given a minor feature or mini-app to build, usually with React, and asked to complete it over a few days.
What they’re looking for:
-
Code quality and structure
-
UI polish and design sense
-
Clear naming, reusable components, and clean layout logic
-
Scalable code
- Considering out-of-scope elements (think caching, normalization, etc)
Tip: Keep it scoped. Don’t overbuild. Write a short README and explain your thought process if you can.
Option B: Technical Phone Screen (standard in big tech)
This typically involves a 45- to 60-minute live coding round using a tool like CoderPad or HackerRank.
You’ll be asked a frontend-focused coding question, often with a light algorithmic twist.
Examples:
-
Implement debounce or throttle in JavaScript
-
Build a simple search box with filtering
-
Solve a problem that uses maps, sets, or recursion
What they’re looking for:
-
Can you code fluently under pressure?
-
Do you understand JS fundamentals?
-
Can you explain your thought process clearly?
If you pass this, you will move on to the onsite round.
3. Onsite (3 to 5 Rounds Total)
The onsite is where most of the objective evaluation happens. Depending on the company, you’ll typically go through a mix of the following rounds:
Round 1: Coding Interview
You’ll solve one or two problems using JavaScript, usually frontend-relevant, but still testing your ability to break down logic, write clean code, and test edge cases.
Expect:
-
DOM or UI logic problems
-
Array or string-based algorithm challenges
-
Utility functions or stateful logic
- The top 90 coding round questions can be found here
Round 2: Frontend System Design
Especially at senior levels, you’ll be asked to design a scalable frontend architecture.
Examples:
-
Design a newsfeed for Facebook
-
Architect a dashboard app with filters and pagination
-
Handle optimistic UI updates and error states
- A comprehensive, free, and in-depth guide to preparing for frontend system design interviews is available here.
They want to see:
-
Your ability to break down complex apps
-
Tradeoffs you consider between frameworks, state management, and performance
-
How do you think about modularity, testing, and scalability
Round 3: App Design or Live Coding
You may be asked to build a real UI component or app live.
This round evaluates:
-
Component design
-
React or vanilla JS fluency
-
Layout, styling, and rendering logic
-
Clear thinking under time pressure
- Live coding round questions can be found here.
Keep things structured and talk out loud. Interviewers care as much about your thought process as the final result.
Round 4: Behavioral or Hiring Manager Round
This round is often underrated but extremely important. It’s where they assess whether you’re a strong communicator, teammate, and a good cultural fit.
Expect:
-
“Tell me about a time you…” questions
-
Questions about your resume or recent projects
-
Team conflict, ownership, or leadership examples
- Behavioral questions can be found here.
Use the STAR format:
Situation, Task, Action, Result. Keep it clear and structured.
Optional Round 5: Second Coding Round
Some on-site interviews include a second technical round, either focusing on a different type of problem or delving deeper into your strengths or areas for improvement from the earlier round.
4. Offer Stage
If you’ve made it this far, congratulations. You’ve done the hard part.
Before you say yes:
-
Try to time your interviews so offers land around the same week
-
Never give a salary number first. Ask for their range
-
Use offers as leverage if you’re interviewing at multiple places
-
Don’t lie about other offers, but do advocate for yourself
The offer stage is a game, too. Play it well, and you can see big jumps in total comp just by knowing how to navigate the negotiation.
Feeling overwhelmed? Don’t worry, the following guide will help you prepare in a structured manner using study plans.
Frontend Interview Question Type By Company

Here is a simple cheat sheet you can reference to understand the types of questions to expect at major top tech companies. You can go a step further and find company-specific questions by clicking here.
| Company | Leetcode | Frontend | React | Notes |
|---|---|---|---|---|
| Yes | Yes | No | Mix of Leetcode and frontend coding rounds. | |
| Somewhat | Yes | No | Frontend-heavy with algorithmic twist. | |
| Microsoft | Occasionally | Yes | No | Mainly frontend, rare Leetcode. |
| OpenAI | No | Yes | Yes | Heavy React focus. |
| Amazon | Yes | Yes | Yes | Frontend plus one Leetcode. |
| Airbnb | No | Yes | Yes | React-focused, no algorithms. |
| Netflix | No | Yes | Yes | Frontend-heavy with React focus. |
| Somewhat | Yes | Yes | Balanced mix of all three. | |
| Stripe | Sometimes | No | Yes | React-focused, Leetcode for staff level. |
| PayPal | No | Yes | Yes | Frontend-heavy, rarely Leetcode. |
| Robinhood | No | Yes | No | Only frontend questions. |
| Zillow | No | Yes | Yes | Focus on the frontend and React. |
| ClickUp | No | Yes | Yes | Frontend and React, no algorithms. |
| Snapchat | Yes | Yes | No | Frontend with Leetcode twist. |
| Vimeo | No | No | Yes | Only React-focused interviews. |
| Adobe | No | Yes | Yes | React and frontend only. |
| TikTok | Yes | Yes | Yes | Full mix across all areas. |
| Uber | Somewhat | Yes | No | Frontend-focused with some algorithms. |
| Atlassian | No | Yes | Yes | Frontend and React only. |
| Coinbase | Yes | Yes | Yes | Balanced mix across all rounds. |
| Snowflake | No | Yes | Somewhat | Mainly frontend-focused. |
| Yelp | No | Yes | Yes | Only frontend and React questions. |
| No | Yes | Yes | Frontend and React, no algorithms. | |
| Intuit | No | Yes | Yes | Frontend and React, no Leetcode. |
Knowing the kind of questions to expect is only half the battle. Next, we will delve into a structured study plan to help you secure the job.
Frontend Interview Study Plan Guide

This guide outlines a suggested four-month plan for preparing for your front-end interviews. However, if you’re crunched for time, don’t worry – we also offer shorter plans, ranging from two weeks to three months. You can find them here. Front-end interview preparation is crucial, and this study plan addresses it by providing a structured approach to help you succeed.
High-level overview of the study plan:
Week 1: Data Structures and Algorithms
Focus on:
-
Stacks and queues
-
Basic tree traversal (in-order, pre-order, post-order)
-
Hashmaps and their applications
-
Recursion and memoization
-
Big O notation for analyzing time and space complexity
The goal isn’t to become an algorithm wizard. It’s to become fluent with the patterns that appear repeatedly. Frontend interviews generally tend not to focus on heavy DSA questions. However, it’s still crucial to know the fundamentals because even those frontend-oriented questions will come with a DSA twist.
You can use this guide to prepare for frontend data structures and algorithms, specifically for frontend interviews.
Week 2: JavaScript, HTML, and CSS Fundamentals
Once your DSA foundation is in place, shift your focus to the building blocks of the web.
Learn and revisit:
-
JavaScript array and object methods
.map(),.reduce(),.filter() -
Strict equality vs type coercion
-
Closures,
this, and scope -
Functional programming concepts
-
Object-oriented JavaScript
-
CSS layout basics (Flexbox, Grid, positioning)
-
HTML semantics and accessibility principles
If you don’t fully understand the language or the browser, frameworks won’t help you.
Weeks 3-4: JavaScript Trivia Questions
Now that you’ve got a solid technical base, it’s time to prepare for explaining what you know.
Practice clear explanations for:
-
Closures
-
Call vs Apply vs Bind
-
Event delegation
-
Hoisting and the temporal dead zone
-
Async behavior (Promises, async/await, event loop)
These types of questions don’t just test your memory; they test how well you understand what’s happening under the hood.
You can find a complete list of expected JavaScript trivia questions here.
Weeks 5-10: JavaScript Coding Problems
Start applying everything you’ve learned. These next few weeks are all about writing code, debugging, and improving your problem-solving speed.
Tackle problems like:
-
Debounce and throttle implementations
-
Custom promise polyfill
-
Implementing
map,filter, andreducefrom scratch -
Memoization utilities
-
Deep cloning an object
Balance your practice between UI-focused tasks and pure logic problems.
The complete list of JavaScript coding problems can be found here.
Weeks 11-12: App Design with Vanilla JS and React
You’ve learned the concepts. Now, show you can build real things.
Create a few small projects:
-
To-do list app
-
Image carousel or photo gallery
-
Modal and tooltip components
-
Search autocomplete with filtering
-
Tic-tac-toe or simple games
Build them in both vanilla JS and React. You’ll gain deeper insights and be ready for whatever the interview throws at you.
The complete list of JavaScript app design problems can be found here.
Weeks 13-16: Frontend System Design
This is where senior and staff interviews start to shine.
Study how to:
-
Gather requirements effectively
-
Break down the frontend architecture into modules and components
-
Design data flow and state management
-
Compare REST vs GraphQL for API needs
-
Optimize performance (lazy loading, caching, etc.)
-
Design for accessibility and responsiveness
Be prepared to discuss trade-offs and justify your decisions.
The complete list of Frontend System Design problems can be found here.
Week 16+: Behavioral Interview Prep
Don’t let this be an afterthought. Behavioral rounds carry significant weight.
Practice using the STAR format:
-
Situation: Set the context
-
Task: What did you need to do
-
Action: What you did
-
Result: What happened and what you learned
Focus on stories that show ownership, communication, and growth. This is your chance to show who you are beyond code.
The complete list of behavioral questions can be found here.
Offer Negotiation
Once you’re done with interviews, the final step is just as important: know your worth and be ready to negotiate.
-
Never give your number first
-
Time your interviews so you get offers around the same week
-
Use competing offers as leverage
-
Always negotiate total comp, not just base salary
Negotiation isn’t about being aggressive. It’s about advocating for your values.
A free negotiation guide for offer negotiations can be found here.
Final Thoughts
Prepping for frontend interviews is no joke. It requires consistency, focus, and a well-planned approach. But the upside is enormous: top roles, better compensation, more fulfilling work.
I highly recommend following this guide, as it successfully helped me land several top-of-the-line job offers when I prepared. My journey led me to build this platform to help others. If this is something you’d like to learn more about, you can read more about it here.
HTML Interview Questions Guide

In most frontend interviews, you’re unlikely to be asked only HTML questions. Usually, the questions combine HTML, CSS, and JavaScript, especially when you’re asked to build or explain a React component. That said, interviewers often sprinkle in specific HTML-related questions within these broader challenges.
This guide walks you through the most common HTML interview questions you might encounter, along with high-level answers to help you prep with confidence.
1. What is an attribute in HTML?
Attributes provide additional information about an element. They modify the behavior or provide metadata about the tag.
<img src="logo.png" alt="Company logo" />
In this example, src and alt are attributes of the img tag.
2. What are IDs and classes in HTML, and when should you use each?
ID: A unique identifier. Should only be used once per page.
Class: Reusable identifier. Can be used on multiple elements.
<div id="main-header" class="header large-header">Welcome</div>
Use classes for styling and layout. Use IDs when you need to reference a single, unique element.
3. What is semantic HTML?
Semantic HTML uses elements that convey meaning. These tags inform both the browser and the developer about the type of content contained within.
<nav>...</nav>
<main>...</main>
<article>...</article>
Semantic tags improve accessibility, maintainability, and sometimes SEO.
4. What are some HTML tags that improve accessibility?
<label>with<input><button>instead of clickable<div><fieldset>and<legend>for form grouping- Proper use of heading tags
aria-*attributes for added context
5. How do you display a table in HTML?
<table>
<thead>
<tr><th>Name</th><th>Age</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>30</td></tr>
</tbody>
</table>
Use <thead>, <tbody>, and <tfoot> to keep your tables organized and accessible.
6. How do you separate sections of text in HTML?
<section>for grouped content<article>for self-contained content<div>for generic block elements<hr>for thematic breaks- Headings like
<h2>,<h3>to structure content
7. What is an iframe, and when would you use it?
<iframe src="https://example.com" width="600" height="400"></iframe>
Everyday use cases include embedding maps, videos, or other third-party content. Use with caution due to performance and security implications.
8. What are HTML tags and attributes?
Tags define the structure, like <p>, <img>, and <a>. Attributes add details or modify how the tag behaves, like href, alt, or class.
9. What does a general HTML layout structure look like?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My App</title>
</head>
<body>
<header>...</header>
<main>...</main>
<footer>...</footer>
</body>
</html>
This is the baseline structure of any semantic HTML document.
10. What are some HTML techniques for performance?
- Use
loading="lazy"on images and iframes - Host assets on a CDN
- Minify CSS and JavaScript
- Use
<link rel="preload">and<link rel="prefetch"> - Compress images and scripts
11. How do you detect if an image has loaded or failed?
const img = document.querySelector('img');
img.onload = () => {
console.log('Image loaded successfully');
};
img.onerror = () => {
console.log('Image failed to load');
};
This helps with fallbacks, loading indicators, or lazy loading logic.
HTML may not take center stage in most frontend interviews, but it remains a core skill. You’ll often be asked subtle but essential questions about semantic tags, structure, and how HTML interacts with CSS and JavaScript.
The key is to understand how HTML fits into the larger frontend puzzle. Nail these questions and you’ll stand out as someone who cares about accessibility, structure, and best practices.
Next, let’s move on to CSS interview questions.
CSS Interview Questions & Answers

In most frontend interviews, you’re unlikely to get only CSS questions. Like HTML, CSS is often mixed into broader coding challenges that combine HTML, CSS, and JavaScript, especially when building or debugging a React component.
That said, CSS-specific questions still arise, and it’s essential to be familiar with them. This guide covers some of the most commonly asked CSS questions at a high level, along with clear examples and explanations.
1. What is the CSS box model?
The box model is the method by which every HTML element is rendered on the page. It includes:
- Content: The inner text or image
- Padding: Space between content and border
- Border: The element’s edge
- Margin: Space outside the border
2. What are some limitations of styling with CSS?
- Global namespace (unless using scoped styles)
- Limited logic (e.g., no conditionals or loops)
- More complicated to manage in large apps without structure
- Specificity wars and overrides
3. How do you center an element in CSS?
For horizontal and vertical centering using Flexbox:
.centered {
display: flex;
justify-content: center;
align-items: center;
}
For text:
text-align: center;
4. What is a CSS preprocessor?
CSS preprocessors, such as Sass or Less, allow you to use variables, nesting, mixins, and functions in CSS. They compile down to plain CSS.
5. What are vh and vw in CSS?
vh = 1% of viewport height. vw = 1% of viewport width.
height: 100vh; /* Full height of the screen */
width: 50vw; /* Half the screen width */
6. What’s the difference between reset and normalize CSS?
Reset.css removes all default styling. Normalize.css keeps useful defaults and fixes inconsistencies between browsers.
7. What’s the difference between inline, inline-block, and block?
- inline: No line break, no box model properties respected
- inline-block: No line break, but respects width/height/margin/padding
- block: Line break, takes up full width
8. What are pseudo-elements and pseudo-classes?
- Pseudo-classes: Apply styles based on element state (e.g.
:hover,:first-child) - Pseudo-elements: Target parts of elements (e.g.
::before,::after)
9. What’s the difference between padding and margin?
- Padding: Space between content and border
- Margin: Space between elements and other elements
10. What is z-index in CSS?
z-index controls the stacking order of elements. Higher values appear on top.
11. What’s the difference between Flexbox and Grid?
- Flexbox: One-dimensional (row or column)
- Grid: A two-dimensional layout system
12. Explain the position property in CSS
static(default)relativeOffsets from the normal positionabsolutePositions relative to the nearest positioned ancestorfixedPositions relative to the viewportstickySwitches between relative and fixed, based on scroll
13. When does DOM reflow or repaint occur?
Reflow: When layout changes (e.g., resize, content change, font change)
Repaint: When visual changes occur without affecting layout (e.g., color, visibility)
14. How is CSS specificity calculated?
Specificity determines which rule wins. Basic formula:
- Inline styles (e.g.
style="") = 1000 - ID selectors = 100
- Class, attribute, pseudo-class = 10
- Element and pseudo-elements = 1
15. IDs vs Classes: Which should you use?
Prefer classes for styling. Use IDs only when targeting a unique element, like in JavaScript or anchors.
16. What is !important In CSS?
!important Forces a rule to override any others, regardless of specificity.
Use sparingly. It makes debugging harder and breaks the cascade. It’s better to use specificity vs !important in most cases.
Final Thoughts
CSS often appears quietly in frontend interviews, not as standalone questions, but rather as part of UI-building tasks or discussions about layout, styling, and responsiveness.
Understanding core concepts, such as the box model, positioning, flex vs. grid, and specificity, will give you an edge. Especially when paired with clear communication and clean code.
Next, we will delve into the Data Structures and algorithms required for Frontend Interviews.
Data Structure and Algorithmic Fundamentals

In front-end interviews, a strong understanding of data structures and algorithms is crucial, as it demonstrates your ability to solve problems efficiently and optimize web applications. Key concepts include:
- Arrays and Strings: Arrays and strings are often used in front-end development for data management and manipulation. They are essential for tasks like sorting data or managing user inputs.
- Objects and Hash Tables: JavaScript objects, often used as hash tables, are vital for quick data retrieval and storage operations. Understanding how to leverage key-value pairs efficiently can significantly enhance the performance of web applications.
- Stacks and Queues: These can be used in UI developments, such as undo mechanisms in text editors or handling asynchronous tasks like AJAX requests in a controlled sequence.
- Trees and Graphs: While more common in backend development, front-end developers may encounter them in scenarios such as DOM manipulations or when implementing features that require hierarchical data structures, like menu systems.
- Algorithms: Sorting algorithms (such as quicksort and mergesort) and searching algorithms (like binary search) are crucial, particularly in optimizing performance-critical applications that handle large datasets.
Understanding these data structures and algorithms is crucial for acing technical interviews and plays a significant role in writing efficient and scalable frontend code. Mastering these areas will better equip you to tackle common front-end challenges, leading to more optimal and practical solutions in your projects.
Check out our free article here for more detailed insights on data structures and algorithms tailored for front-end interviews.
In frontend interviews, you’re expected to do more than just code. You’re expected to understand how the frontend works—from the browser’s rendering engine to how JavaScript handles async behavior. The questions can range from semantic HTML to CSS layout strategies, from JavaScript quirks to React-specific lifecycle methods. Sometimes you’re debugging. Sometimes you’re designing. And sometimes, you’re just expected to explain.
Below is a curated list of the most frequently encountered questions across real frontend interviews. Each one links to a focused breakdown designed to help you solidify your understanding and walk into your following interview with confidence.
Frontend Trivia Questions

In frontend interviews, you’re expected to do more than just code. You’re expected to understand how the frontend works, from the browser’s rendering engine to how JavaScript handles async behavior. The questions can range from semantic HTML to CSS layout strategies, from JavaScript quirks to React-specific lifecycle methods. Sometimes you’re debugging. Sometimes you’re designing. And sometimes, you’re just expected to explain.
Below is a curated list of the most frequently encountered questions across real frontend interviews. Each one links to a focused breakdown designed to help you solidify your understanding and walk into your following interview with confidence.
Top Questions To Expect
In frontend interviews, you’re expected to know how the frontend works, not just build UIs. Interviewers will dig into how browsers render pages, how JavaScript handles async code, how React updates the DOM, and how you’d handle performance, security, or CSS edge cases. The questions can range from HTML, CSS, JS, to React, and everything in between.
Below is a high-signal list of frequently asked frontend interview questions. Each one links to a concise, in-depth dive, so you can study efficiently and walk into your interviews with clarity.
- Event Loop
- Propagation
- Progressive enhancement vs Graceful degradation
- Explain “this”
- Prototypal Inheritance
- null vs undefined vs undeclared
- Closures
- Array Methods
- Call vs Apply
- Event Bubbling
- Hoisting
- Event Delegation
- CORS
- Props and State
- Lifecycle Methods
- Differences between various Instantiations
- let, var, and const
- Rest vs Spread Operators
- Resetting vs Normalizing CSS
- Block Formatting Context
- Anonymous Functions
- “Attribute” VS “Property”
- Host Objects vs Native Objects
- Mutable VS Immutable
- Tag attributes
- Synchronous VS Asynchronous
- Higher-Order Function
- Classical Inheritance VS Prototypal Inheritance
- Functional programming vs object-oriented programming
- Lexical
- ES6 maps over objects
- Sets vs Arrays
- Destructuring an object or an array
- ES6 Template Literals
- Curry functions
- ES2015
- Functional/integration test
- Linting
- Web Request Lifecycle
- Programming paradigms
- Functional Programming
- Pure Component
- Higher-order components
- React Hooks
- React reconciliation
- Scale A Website
- Polyfill
- “use strict”
- Block vs inline elements
- typeof, instanceof, and Object.prototype.toString
- Reflow vs repaint
- Critical Rendering Path
- Inserting DOM Elements
- SASS/LESS
- Micro vs Macro tasks
- Handling Memory Leaks
- HTTP GET and POST requests
- Classical inheritance
- Prototypal inheritance
- Asynchronous calls
- Function declarations and expressions
- What is Semantic markup in frontend?
- Object.create vs new
These questions cover a range of topics, from HTML and CSS fundamentals to modern web technologies and performance optimization. Preparing for these questions will help you ace the interview and solidify your understanding of front-end development concepts.
JavaScript interview questions

Let’s showcase the 75 most commonly asked Frontend interview questions in JavaScript.
- 1. Find Corresponding Node
- 2. Improve a function
- 3. Flatten I
- 4. Debounce I
- 5. Throttle
- 6. Total Salaries
- 7. Gym Sessions
- 8. Array Methods
- 9. Build Promise
- 10. ClassNames
- 11. Create DOM
- 12. Phone Number Parser
- 13.Deep Clone
- 14. Event Emitter
- 15. EventTarget
- 16. Traverse DOM
- 17. Flatten II
- 18. Intersection Observer
- 19. Memoize I
- 20. Masonry Grid
- 21. Navigation
- 22. Next Right Sibling
- 23. Node Store
- 24. Parser for Rich Text Editor
- 25. Promisify Any Function
- 26. Skill Endorsements
- 27. Testing Framework
- 28. Text Highlighter
- 29. Throttle II
- 30. Tic Tac Toe
- 31. Top K Words
- 32. Image Slider
- 33. Virtual DOM I
- 34. Virtual DOM II
- 35. Virtual DOM III
- 36. API Confirmation
- 37. API Search and Render Image
- 38. Asynchronous Request Queue
- 39. Auto Suggest Search List
- 40. Autocomplete Search List
- 41. ClearAllIntervals()
- 42. ClearAllTimeouts()
- 43. Compose Function
- 44. Curry Function
- 45. Custom “this” Methods
- 46. Debounce II
- 47. Debounce III
- 48. Deep Equals
- 49. Event Emitter II
- 50. Event Logger I
- 51. Event Logger II
- 52. File Navigation
- 53. Filtering Matching JSON
- 54. Flatten III
- 55. Flatten IV
- 56. Flatten V
- 57. Flatten VI
- 58. Flatten VII
- 59. Flatten XI
- 60. getElementsByClassName
- 61. Hierarchical Checkbox
- 62. Histogram
- 63. Infinite Scrolling News Feed
- 64. K MostText Nodes
- 65. Memoize II
- 66. Promise Methods
- 67. querySelectorAll
- 68. Rate Limiter
- 69. Animate Element To The Right
- 70. RxJS Observable
- 71. Set Interval with Linear Delay
- 72. Stream
- 73. String Repeater
- 74. Tabs
- 75. Todo App
Remember, understanding the question is just as crucial as knowing the answer. It’s not enough to have a superficial grasp of the solutions; what sets candidates apart is their ability to apply the most efficient and optimized solutions to problems, particularly in the fast-evolving field of front-end development. To aid in this, we introduced frontendlead.com, a resource designed to offer in-depth explanations and video tutorials for each question, ensuring you’re well-equipped to tackle any challenge that comes your way in a front-end engineering interview.
App Design Questions (Machine Coding) in Front-End Interviews (2025 Guide)

If you’re preparing for frontend interviews, you’ve likely already encountered questions about app design. But what are they exactly?
App design questions are practical questions that ask you to build a small application. That could mean creating a to-do list, a photo gallery, a tic-tac-toe game, or an autocomplete search box. These aren’t theoretical; they test your real-world engineering ability to build, organize, and scale UI applications. You will most likely be asked to make these using React or vanilla JavaScript.
How to Prepare for App Design Rounds
The most significant piece of advice: don’t just focus on building the feature. You also need to demonstrate that you can scale it effectively.
Things to think about:
- Component design: How will you break your UI into components?
- State management: Are you using
useState?useContext?Redux? - Data flow: Can your app handle updates and props cleanly without unnecessary re-renders?
Yes, even in a 45-minute interview, it might make sense to use Redux depending on the problem. In most cases, you’ll use useState and then discuss how the app could evolve using useContext Or Redux as it grows in complexity. Ensure you can clearly explain the advantages and disadvantages of each approach.
I recommend using the MVVM (Model-View-ViewModel) design pattern for structuring your React components. I wrote an in-depth article about it here: MVVM Pattern in React
Performance Tips to Call Out
Interviewers love hearing you think about performance, especially if you mention it before they do.
- Caching: LocalStorage, SessionStorage, Cookies, or IndexedDB (talk about them even if you don’t have time to implement)
- Debouncing: If you’re building an autocomplete, debounce your API calls using Lodash or a custom debounce utility
- Infinite scrolling: Use
IntersectionObserverto detect when the user hits the bottom of the list - Pagination: Bonus points if you discuss cursor-based pagination vs. page-based pagination
Even if you can’t implement all of this in the interview, talking about these patterns shows senior-level thinking.
Expect to Fetch & Render
Many app design questions involve fetching data from an API, rendering it in the DOM, and applying styling, including hover effects or transitions.
If you’re building something like a list or a grid, discuss:
- Virtualized lists (
react-window,react-virtualized) for performance - When and how you’d trigger data loading
- How do you organize the UI for reusability
Recommended Practice Questions
FrontendLead offers a growing list of app design questions you can practice here: Practice App Design Questions
Some great ones to start with:
- Build a to-do list (great for covering full CRUD)
- Build a photo gallery with fetched images
- Build an image slider
- Build a masonry layout
- Build a chat app UI
- Build a search bar with debounce
- Build a mini Airbnb-style listing UI
The point is to build lots of small UIs and optimize them as you go.
Below is a table showcasing typical app design questions you might encounter, with examples in both React and Vanilla JavaScript:
| App Type | Description | React Example | Vanilla JS Example |
|---|---|---|---|
| To-do List | Create an app to manage daily tasks | Use state to manage list items | Manipulate the DOM to add/remove tasks |
| Photo Gallery | Develop a grid-based photo display app | Use components for gallery items | Use CSS Grid for layout |
| Image Slider | Build a carousel for navigating through images | Implement with React state for the active slide | Use timers and DOM manipulation |
| Masonry Layout | Create a Pinterest-like column-based layout | Use CSS Modules for styling | Apply column-width CSS dynamically |
| Tic Tac Toe | Design a game with a minimal user interface | Use React state for storing the game board | Track clicks and check for win conditions |
| Small Game | Develop a simple interactive game like Snake | Leverage React effects for game logic | Use Canvas API for rendering |
What About React vs. Vanilla JavaScript?
Most companies will expect you to use React. However, some platforms, such as Google, may require you to use only HTML, CSS, and JavaScript. So it’s worth being ready for both.
That said, Google typically doesn’t ask full-blown app design questions. They may instead request minor variations, such as adding an accessible checkbox, a toggle button, or a dropdown.
Final Thoughts
If you’re serious about front-end interviews, app design questions are a must-practice category. They reflect the kind of work you’ll be doing, and they’re the most fun to solve, too.
Try building 5–10 small apps before your interviews. Learn to structure your code, manage state, and discuss trade-offs as you create. That’s how you’ll stand out.
You can get started with app design questions here: Start Practicing
React JS Interview Questions with Solutions

Before diving into React interview questions, your fundamentals must be solid. If you’re shaky on HTML, CSS, or JavaScript, you’re going to struggle with real-world React code, let alone interviews. Ensure you spend time mastering the core building blocks of the frontend before delving into React-specific concepts.
That said, let’s walk through some of the most frequently asked React.js interview questions. Each one covers not just the “what,” but the “why,” and includes code examples to help you understand how it works.
At a high level, we will cover:
- React JS Specific Questions
- React Router Questions
- React Testing Questions
- State Management Questions
- React Performance Questions
Let’s begin!
React JS Specific Questions
What are props and state in React, and what’s the difference?
Props are read-only values passed from a parent component to a child. State is local data managed within an element itself. Props are immutable from the child’s perspective, while state can be updated via hooks like useState.
// Functional component with both props and state
import React, { useState } from "react";
function Counter({ title }) {
const [count, setCount] = useState(0); // state: owned by this component
return (
<div>
<h2>{title}</h2> {/* prop: passed from parent */}
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
);
}
What is the Virtual DOM, and how does it work?
The Virtual DOM is an in-memory representation of the actual Document Object Model (DOM). When state or props change, React creates a new virtual DOM tree, compares it with the previous one (diffing), and updates only the parts of the real DOM that changed, minimizing expensive DOM operations.
What is React Fiber, and what are its main goals?
React Fiber is the internal engine behind React’s rendering. It allows React to break rendering work into small units and pause or resume it, improving responsiveness for complex UI updates. Its primary goals are concurrency, interruptible rendering, and better scheduling.
What are Higher-Order Components (HOCs) in React?
A Higher-Order Component is a function that takes a component and returns a new element with enhanced behavior. It’s a typical pattern for code reuse.
// A simple HOC that adds a "theme" prop
function withTheme(Component) {
return function ThemedComponent(props) {
return <Component {...props} theme="dark" />;
};
}
function Button(props) {
return <button className={props.theme}>Click</button>;
}
const ThemedButton = withTheme(Button);
What’s the difference between useMemo and useCallback?
useMemo caches a **computed value**; useCallback caches a **function**. Use useMemo when you want to avoid expensive recalculations. Use useCallback when you want to avoid re-creating a function on every render.
import React, { useMemo, useCallback, useState } from "react";
function Example({ items }) {
const [count, setCount] = useState(0);
// Cached sorted items (useMemo)
const sorted = useMemo(() => {
return [...items].sort();
}, [items]);
// Cached click handler (useCallback)
const handleClick = useCallback(() => {
setCount(count + 1);
}, [count]);
return (
<div>
<button onClick={handleClick}>Increment</button>
<ul>{sorted.map(i => <li key={i}>{i}</li>)}</ul>
</div>
);
}
How do you memoize a component and why?
Use React.memo to memoize functional components. It prevents unnecessary re-renders when props haven’t changed. This is useful for optimizing performance, especially in large lists or deeply nested UIs.
const Greeting = React.memo(function Greeting({ name }) {
console.log("Rendered!");
return <p>Hello, {name}!</p>;
});
// Will only re-render if `name` changes
How do you loop inside JSX to create elements?
You can loop using JavaScript’s map() function to generate JSX dynamically. This is commonly used to render lists.
function List({ items }) {
return (
<ul>
{items.map((item, index) => (
<li key={index}>{item}</li>
))}
</ul>
);
}
Why should you not update props in React?
Props are meant to be immutable — the parent component controls them. Updating props inside a child breaks the unidirectional data flow in React and can cause unpredictable bugs.
// ❌ Never do this
function MyComponent(props) {
props.title = "New Title"; // Invalid
}
Can you use async/await In React?
Yes. You can use async/await inside event handlers, or inside useEffect (just not directly in the effect function — you must define an async function inside it).
import { useEffect, useState } from "react";
function UserProfile() {
const [user, setUser] = useState(null);
useEffect(() => {
async function fetchUser() {
const res = await fetch("/api/user");
const data = await res.json();
setUser(data);
}
fetchUser(); // Call the async function
}, []);
return user ? <p>Hello {user.name}</p> : <p>Loading...</p>;
}
What are the most commonly used hooks in React?
React provides a number of built-in hooks to manage state, side effects, and performance. Some of the most commonly used ones include:
useState– For managing local stateuseEffect– For running side effects after renderuseMemo– For memoizing expensive valuesuseCallback– For memoizing functionsuseRef– For persisting values between renders (without re-rendering)useContext– For accessing context across your component tree
What are custom hooks and when should you use them?
Custom hooks let you extract reusable logic from components into separate functions that can be reused across your app. They follow the same rules as built-in hooks and start with the word use.
// Custom hook to get current window width
import { useState, useEffect } from "react";
function useWindowWidth() {
const [width, setWidth] = useState(window.innerWidth);
useEffect(() => {
const handleResize = () => setWidth(window.innerWidth);
window.addEventListener("resize", handleResize);
return () => window.removeEventListener("resize", handleResize);
}, []);
return width;
}
// Usage
function App() {
const width = useWindowWidth();
return <p>Current width: {width}px</p>;
}
What’s the difference between functional and class-based components?
Class components use class syntax and require you to use this, while functional components are simpler, more concise, and use hooks for state and lifecycle logic. As of today, functional components are the standard in modern React.
// Class component
class Greeting extends React.Component {
render() {
return <p>Hello {this.props.name}</p>;
}
}
// Functional component (preferred)
function Greeting({ name }) {
return <p>Hello {name}</p>;
}
Why does the virtual DOM exist?
The virtual DOM exists to improve performance and simplify UI updates. Manipulating the real DOM is slow. React batches updates in a virtual DOM (a lightweight JS object), then figures out the minimal set of changes needed, and updates the real DOM efficiently.
What are error boundaries in React?
Error boundaries are React components that catch JavaScript errors in their child components and display a fallback UI instead of breaking the app. You can only define error boundaries using class components.
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError(error) {
return { hasError: true };
}
componentDidCatch(error, info) {
console.error("Caught error:", error);
}
render() {
if (this.state.hasError) {
return <h2>Something went wrong.</h2>;
}
return this.props.children;
}
}
What are React lifecycle methods (or hook equivalents)?
In class components, lifecycle methods include:
componentDidMountcomponentDidUpdatecomponentWillUnmount
In functional components, the equivalent is the useEffect hook.
// Equivalent of componentDidMount
useEffect(() => {
console.log("Component mounted");
}, []);
What happens if the dependency array in useEffect is empty?
If the dependency array is empty [], the effect runs only once after the first render — like componentDidMount. If you omit the dependency array entirely, the effect runs on every render, which can lead to performance issues.
What is a ref in React, and why is it useful?
A ref is a way to access and interact with DOM elements or store a mutable value without triggering a re-render. Useful for focusing inputs, measuring layout, or storing timeouts.
import { useRef, useEffect } from "react";
function InputFocus() {
const inputRef = useRef();
useEffect(() => {
inputRef.current.focus(); // Access DOM node directly
}, []);
return <input ref={inputRef} />;
}
What is useContext and when would you use it?
useContext gives you access to values provided by a React Context provider without the need for prop drilling. Use it when you need to share state across multiple components (such as themes or authentication).
// Create context
const ThemeContext = React.createContext("light");
// Use it in a component
function ThemeLabel() {
const theme = React.useContext(ThemeContext);
return <p>Current theme: {theme}</p>;
}
// Wrap part of the app
<ThemeContext.Provider value="dark">
<ThemeLabel />
</ThemeContext.Provider>
What are the different phases of a React component’s lifecycle?
React components go through these phases:
- Mounting – Component is created and added to the DOM
- Updating – Component re-renders due to props or state change
- Unmounting – Component is removed from the DOM
In functional components, you use useEffect with dependencies to handle each phase. You can return a cleanup function from useEffect to mimic componentWillUnmount.
useEffect(() => {
// Mounting
console.log("Component mounted");
// Cleanup
return () => {
console.log("Component unmounted");
};
}, []);
React Router Interview Questions
What is the purpose of push and replace in React Router history?
The history.push() and history.replace() methods let you navigate programmatically in React Router. The difference is:
push()adds a new entry to the history stack (user can go back).replace()replaces the current entry (user can’t go back).
history.push("/dashboard"); // Navigate to dashboard, keep history
history.replace("/login"); // Navigate to login, replace current entry
How do you programmatically navigate using React Router 4+?
You can use the useNavigate hook in React Router v6+ or the useHistory hook in v5 to navigate programmatically.
// React Router v6+
import { useNavigate } from "react-router-dom";
function RedirectButton() {
const navigate = useNavigate();
return (
<button onClick={() => navigate("/home")}>Go Home</button>
);
}
// React Router v5
import { useHistory } from "react-router-dom";
function RedirectButton() {
const history = useHistory();
return (
<button onClick={() => history.push("/home")}>Go Home</button>
);
}
How do you get query parameters from React Router?
In React Router v6, use useSearchParams(). In React Router v5, use useLocation() with the browser’s URLSearchParams API.
// React Router v6
import { useSearchParams } from "react-router-dom";
function Page() {
const [searchParams] = useSearchParams();
const user = searchParams.get("user");
return <p>User: {user}</p>;
}
// React Router v5
import { useLocation } from "react-router-dom";
function Page() {
const location = useLocation();
const query = new URLSearchParams(location.search);
const user = query.get("user");
return <p>User: {user}</p>;
}
How do you pass parameters with history.push() in React Router 4?
You can pass route parameters using the URL or state object.
// Using URL params
history.push("/user/123");
// Using state
history.push({
pathname: "/user",
state: { userId: 123 },
});
React Testing Interview Questions
What is shallow rendering in React testing?
Shallow rendering is a technique where only the component itself is rendered, not its children. It’s useful when testing a component in isolation without worrying about its descendants.
// With Enzyme
import { shallow } from "enzyme";
import MyComponent from "./MyComponent";
const wrapper = shallow(<MyComponent />);
What is the react-test-renderer package?
react-test-renderer is a package from React that allows you to render components to pure JavaScript objects without depending on the DOM. It’s useful for snapshot testing.
import renderer from "react-test-renderer";
import MyComponent from "./MyComponent";
const tree = renderer.create(<MyComponent />).toJSON();
expect(tree).toMatchSnapshot();
What is Jest?
Jest is a JavaScript testing framework maintained by Meta. It’s used to write unit tests, mock functions, and create snapshots. Jest is the default test runner for most React apps (like those created with Create React App).
What are the advantages of Jest over Jasmine?
Jest builds on top of Jasmine but adds powerful features like:
- Built-in mocking and spies
- Zero config setup with CRA
- Snapshot testing support
- Better DX with watch mode and rich assertions
Can you show a simple Jest test case using React?
// Counter.js
export function Counter({ count }) {
return <p>Count: {count}</p>;
}
// Counter.test.js
import { render, screen } from "@testing-library/react";
import { Counter } from "./Counter";
test("renders count", () => {
render(<Counter count={5} />);
expect(screen.getByText(/Count: 5/)).toBeInTheDocument();
});
State Management Interview Questions
What are the pros and cons of using Redux?
Pros:
- Centralized state management
- Predictable state transitions through pure reducers
- Time-travel debugging with Redux DevTools
- Great ecosystem and middleware support (like Thunks, Sagas)
Cons:
- Boilerplate-heavy without proper abstraction
- Can be overkill for small to medium apps
- Steeper learning curve for new developers
What’s the difference between mapStateToProps and mapDispatchToProps?
mapStateToProps connects Redux state to your component’s props, while mapDispatchToProps connects action dispatchers to your props so you can trigger state changes.
// Example:
const mapStateToProps = (state) => ({
count: state.counter,
});
const mapDispatchToProps = (dispatch) => ({
increment: () => dispatch({ type: "INCREMENT" }),
});
At a high level, how do Redux patterns work?
Redux follows a unidirectional data flow:
- Action: A plain JS object that describes what happened.
- Reducer: A pure function that takes the current state and the action, and returns the new state.
- Dispatch: Sends the action to the Redux store to update the state.
// Action
const incrementAction = { type: "INCREMENT" };
// Reducer
function counterReducer(state = 0, action) {
if (action.type === "INCREMENT") {
return state + 1;
}
return state;
}
// Dispatch
dispatch(incrementAction);
What’s the difference between React Context and React Redux?
Both allow you to share state across your app, but they serve different purposes:
- React Context: A Simple, built-in tool for global values (like theme or language).
- Redux: Full-blown state management library with predictable state handling, devtools, and middleware for side effects.
If you’re passing values deeply and only need read/write access in a few places, it useContext works well. If you’re managing complex app-wide state with multiple async flows, Redux might be a better fit.
What are the downsides of using Redux?
The most significant downsides are complexity and boilerplate. For simple apps, Redux can feel like too much work to wire up. It also introduces more abstraction, which can confuse newer devs if not well-documented. Performance isn’t always better unless it is carefully optimized.
Should you keep all your component state in the Redux store?
No. Only keep **shared state** that multiple components rely on in Redux. UI-specific or temporary state (like modals, inputs, animations) should stay local in the element using useState.
What’s the proper way to access the Redux store?
In React-Redux, use the useSelector hook to read the state and useDispatch to send actions. This is the recommended approach in functional components.
import { useSelector, useDispatch } from "react-redux";
function Counter() {
const count = useSelector((state) => state.counter);
const dispatch = useDispatch();
return (
<div>
<p>Count: {count}</p>
<button onClick={() => dispatch({ type: "INCREMENT" })}>Add</button>
</div>
);
}
What is a Redux Thunk?
A Redux Thunk is a middleware that lets you write action creators that return a function instead of an object. It’s commonly used to handle asynchronous logic, such as fetching data.
export const fetchUser = () => {
return async (dispatch) => {
dispatch({ type: "USER_LOADING" });
const res = await fetch("/api/user");
const data = await res.json();
dispatch({ type: "USER_SUCCESS", payload: data });
};
};
How do you measure Redux performance?
Use the Redux DevTools extension. It allows you to inspect every dispatched action, see how state changes over time, and track slow reducers or significant updates.
How do you improve Redux performance?
Some key ways to improve Redux performance:
- Use
React.memoanduseMemoto avoid unnecessary re-renders - Split large reducers to avoid full app updates
- Use selector libraries like
reselectto memoize computed data - Keep your store flat and normalized
When should you use Redux over useContext or useState?
Use useState for the local state. Use useContext for a lightweight global state (themes, authentication user, etc.). Use Redux when:
- You have shared state across many components
- You need middleware or complex side-effect handling
- You want predictable, debuggable state transitions
That said, if your app doesn’t have complex global state, stick to useState and useContext — They’re lighter and easier to work with.
React Performance Optimization Interview Questions
How do you solve performance corner cases with React?
It depends on the root cause, but in general:
- Use
React.memoto avoid unnecessary re-renders - Use
useCallbackanduseMemoto memoize values and handlers - Use virtualization (e.g.,
react-window,react-virtualized) for long lists - Lazy load components using
React.lazyandSuspense - Throttle or debounce expensive state updates (like scroll listeners)
How do you audit your React app to find performance bottlenecks?
Use React DevTools Profiler to record a render pass and inspect which components are re-rendering too often or taking too long. You can also:
- Track prop changes with the
why-did-you-renderpackage - Use console timing (
console.time()) to measure function execution - Inspect slow components with the Flamegraph view in Profiler
Are there any online tools available to help with performance auditing?
Yes. These tools help audit your bundle size, load times, and runtime performance:
- Lighthouse (Chrome DevTools) – Page load, TTI, and performance score
- WebPageTest.org – Waterfall breakdowns and paint metrics
- Bundlephobia – Package size insights
- SpeedCurve – Continuous front-end performance monitoring
If Redux is a bottleneck, how can it be optimized?
A few things to try:
- Use
useSelectorwith memoized selectors (likereselect) - Split reducers to avoid full app updates on every action
- Normalize deeply nested state
- Use
React.memoto prevent re-renders on unchanged props - Avoid dispatching actions on every keystroke — debounce or batch them
If your initial page load is slow, how would you optimize it?
Some ways to speed up your initial load:
- Code-split with
React.lazyandSuspense - Preload critical assets using
<link rel="preload"> - Use smaller bundle sizes (analyze with
webpack-bundle-analyzer) - Serve assets via CDN and compress them (gzip or brotli)
- Inline critical CSS and defer non-essential JS
How do you measure page load time?
You can use:
- Lighthouse – First Contentful Paint (FCP), Largest Contentful Paint (LCP)
- Performance tab in Chrome DevTools – Record load timeline
window.performance.timing– For custom tracking- Third-party tools like SpeedCurve or New Relic
You want to run a performance experiment. How would you measure improvements?
Use A/B testing or feature flags:
- Measure time-based metrics like TTI, LCP, scroll jank before/after
- Track render time of specific components (e.g. using
performance.now()) - Use Mixpanel or custom analytics events to compare user impact
Compare metrics across real user sessions to validate gains.
Scrolling feels janky and stutters. How would you fix it?
Common fixes:
- Use
requestAnimationFramefor smooth animations - Debounce scroll handlers to prevent frequent re-renders
- Use virtualized lists to avoid DOM overload
- Avoid triggering layout thrashing (e.g., calling
getBoundingClientRectrepeatedly)
How do you measure scroll performance?
Use the Chrome DevTools Performance tab:
- Record a scroll session
- Look for long scripting or layout paint times
- Watch for forced reflows or excessive layout recalculations
You can also track scroll FPS using Chrome’s rendering tab or `fps-meter` overlays.
How do you detect memory leaks in React?
Memory leaks in React usually happen when components retain references after unmounting — like open subscriptions, timeouts, or event listeners that were never cleaned up.
To detect them:
- Use Chrome DevTools → Performance → Heap snapshot tab
- Watch for detached DOM nodes in the memory graph
- Use the
why-did-you-renderlibrary to spot unnecessary renders - Use
useEffectcleanup functions to remove listeners, timers, or subscriptions
useEffect(() => {
const interval = setInterval(() => {
// polling logic
}, 1000);
return () => {
clearInterval(interval); // Clean up to prevent memory leaks
};
}, []);
How do you add security to a React application?
While React handles UI, it’s still your job to secure the app from common threats:
- Prevent XSS: Avoid using
dangerouslySetInnerHTMLunless properly sanitized - Use HTTPS: Always serve over HTTPS to protect data in transit
- Escape user input: Never trust user-generated content directly in the DOM
- Use HTTP-only cookies: For storing auth tokens (avoid localStorage when possible)
- Set CORS headers properly: Especially on APIs
- Rate limit and throttle: Backend endpoints to prevent abuse
Also consider tools such as Content Security Policy (CSP), security headers, and automated scanners like npm audit or OWASP ZAP during the CI/CD process.
The questions above would cover a majority of React JS interview questions. Now, let’s move on to Frontend System Design questions.
Frontend System Design Questions Guide

Understanding Front-End System Design involves a comprehensive evaluation of how components interact within the client side of a web application and the API design between the client and the server. This section explores the critical elements and processes that candidates must master for front-end system design interviews.
If you’re looking for a more in-depth, free guide, we recommend exploring our comprehensive all-in-one front-end system design preparation guide.
Build React Components Using MVVM Design Pattern

React is well-known for its component-based architecture, which allows developers to break interfaces into smaller, reusable parts. Yet, as applications grow, it’s common to see “monolithic” components that try to manage fetching data, handling state, performing side effects, and rendering UI in one place. This often leads to code that is difficult to maintain, test, and scale.
Design patterns offer a robust way to address these issues by formally separating responsibilities. One of the most effective patterns for structuring React applications is MVVM (Model-View-ViewModel). By adhering to MVVM principles, developers can keep their components (Views) focused on rendering and delegate data logic to dedicated ViewModels. This guide explores applying MVVM in React, what belongs in a ViewModel (and what doesn’t), and how to structure your code to maximize clarity, testability, and scalability.
The Problem with Monolithic React Components
A typical React component can quickly become bloated. Consider a user profile component that fetches user data, manages form state for searching, applies side effects (like scrolling or analytics), and renders the final UI. Below is an example of how quickly logic can accumulate:
function UserProfile() {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [searchTerm, setSearchTerm] = useState('');
const userContainerRef = useRef(null);
useEffect(() => {
async function fetchData() {
try {
const response = await fetch('https://api.example.com/user');
const data = await response.json();
setUser(data);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
}
fetchData();
}, []);
useEffect(() => {
if (user && userContainerRef.current) {
userContainerRef.current.scrollTop = userContainerRef.current.scrollHeight;
}
}, [user]);
function handleSearchChange(event) {
setSearchTerm(event.target.value);
}
function handleSearch() {
console.log('Searching for:', searchTerm);
}
if (loading) return <div>Loading user data...</div>;
if (error) return <div>Error: {error}</div>;
return (
<div ref={userContainerRef}>
<h1>{user?.name}</h1>
<input value={searchTerm} onChange={handleSearchChange} placeholder="Enter search term" />
<button onClick={handleSearch}>Search</button>
</div>
);
}
export default UserProfile;
The Power of Design Patterns in React
Design patterns provide a structured way of thinking about state, logic, and UI. Below are three widely used patterns:
MVC (Model-View-Controller)

- Model: Data structures, domain logic, persistence.
- View: UI presentation.
- Controller: Handles user input and updates the View.
MVP (Model-View-Presenter)

- Model: Data and business logic.
- Presenter: Manages logic and transforms data for the View.
- View: A “dumb” UI that delegates actions to the Presenter.
MVVM (Model-View-ViewModel)

- Model: Data source (e.g., API, local storage).
- ViewModel: Manages state, transformations, and side effects.
- View: A React component that consumes ViewModel data.
Implementing MVVM in React
The Model (userService.js)
export async function getUserData() {
const response = await fetch('https://api.example.com/user');
if (!response.ok) {
throw new Error('Failed to fetch user data.');
}
return response.json();
}
The ViewModel (useUserProfileViewModel.js)
import { useState, useEffect, useRef } from 'react';
import { getUserData } from '../services/userService';
export function useUserProfileViewModel() {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const containerRef = useRef(null);
useEffect(() => {
async function fetchUser() {
try {
const data = await getUserData();
setUser(data);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
}
fetchUser();
}, []);
return { user, loading, error, containerRef };
}
The View (UserProfile.jsx)
import React from 'react';
import { useUserProfileViewModel } from './useUserProfileViewModel';
function UserProfile() {
const { user, loading, error, containerRef } = useUserProfileViewModel();
if (loading) return <div>Loading user data...</div>;
if (error) return <div>Error: {error}</div>;
return (
<div ref={containerRef}>
<h1>{user?.name}</h1>
</div>
);
}
export default UserProfile;
Final Thoughts
Applying MVVM to React components provides clear separation of concerns, improves maintainability, and enhances testability. By structuring your app around Models, ViewModels, and Views, you ensure a scalable, organized, and testable architecture.
Behavioral questions

Behavioral interviews for software engineers are not just about assessing technical prowess; they delve deeper into a candidate’s soft skills, such as leadership, communication, collaboration, and problem-solving abilities. These interviews employ behavioral questions to unearth the candidate’s past behavior in specific scenarios, effectively predicting their future behavior in similar circumstances. This emphasis on past experiences and behaviors acknowledges that soft skills are equally pivotal as technical capabilities in software engineering roles, ensuring a comprehensive evaluation of a candidate’s suitability for a position.
Explore our free, in-depth guide to help you prepare for behavioral interview questions.
Salary Negotiation

Negotiating a job offer is a crucial skill for software engineers. It reflects their understanding of their worth and ability to secure favorable terms. This is especially important in a high-demand field where options are plentiful, and each decision impacts career trajectory.
A successful negotiation extends beyond salary discussions to include bonuses, roles, responsibilities, and work conditions. Mastering this art involves recognizing your value, conducting thorough research, using precise timing, communicating clearly, and gracefully handling objections.
Understanding Your Value: Start by assessing your technical skills, including proficiency in critical algorithms and software development, which are essential for driving tech innovations. Document your achievements and certifications to create a compelling value proposition that outlines your contributions.
Market Research: Utilize resources like Levels.fyi and Payscale to understand the standard compensation for your role and experience level. Consider local demand for your skills and how specific companies have compensated for similar roles.
Strategize Your Negotiation Approach: Emphasize your potential for growth and leverage any competing offers to strengthen your position. Tailor your strategy based on your experience level—new grads might focus on growth opportunities, while seasoned professionals can negotiate based on proven impact.
Preparation and Timing: Familiarize yourself with all aspects of the offer and determine your salary expectations and minimum acceptable offer, but keep these private. Practice presenting your case to negotiate confidently.
Check out our free article here for a more in-depth guide on negotiating as a software engineer and how this can enhance your interview preparation.
How to not screw up the negotiation

Navigating job offer negotiations can be challenging, and even seasoned software engineers can make common mistakes that compromise their potential job terms. Understanding what to avoid can significantly enhance your ability to secure a favorable outcome.
Common Pitfalls in Negotiation:
- Lacking Preparation: Entering negotiations without thorough research on the company, industry salary standards, and your value can leave you vulnerable. It’s essential to come prepared with a clear understanding of what you deserve and the flexibility of the offer components.
- Accepting Too Quickly: Although it may be tempting to accept an offer immediately, especially if it meets your expectations, it is crucial to consider all aspects of the offer thoroughly. This includes benefits, potential for growth, and alignment with your career goals.
- Focusing Solely on Salary: Although salary is a significant part of the compensation package, other elements, such as bonuses, equity, work-life balance, and professional development opportunities, can also be valuable.
- Poor Communication: Being too aggressive or too passive can work against you. Maintaining a professional demeanor, clearly articulating your expectations, and negotiating assertively yet politely are essential.
- Not Recognizing When to Walk Away: Understanding your deal-breakers and recognizing when an offer doesn’t meet your minimum requirements is crucial. Holding out for a better opportunity can sometimes be more beneficial than accepting an unsatisfactory offer.
Strategies for Effective Negotiation:
- Thorough Preparation: Before entering negotiations, understand your market value, the company’s compensation trends, and your minimum acceptable offer. Use tools and resources to gather this information.
- Evaluate the Entire Package: Consider all aspects of the offer, not just the salary. Evaluate how other benefits contribute to your overall job satisfaction and long-term career goals.
- Communicate Effectively: Practice your negotiation points, focusing on clear and concise communication to ensure effective outcomes. Express enthusiasm for the position while stating your case for a better offer.
- Know Your Worth: Be confident in your skills and experience. Demonstrating awareness of your value can influence the negotiation in your favor.
For a deeper understanding of negotiation strategies and to avoid common mistakes, check out our comprehensive guide on job offer negotiation for software engineers here. This guide provides detailed insights to help you navigate this critical aspect of your career development effectively.
Conclusion
Recognizing that preparing for these interviews is not always the most exciting task, the guide aims to provide a comprehensive toolkit for success. It focuses on real-world questions specific to frontend technologies, such as HTML, CSS, and JavaScript, differing from the typical software engineering interviews that often focus more on algorithms.
The guidebook thoroughly details the various stages of the front-end interview process, from initial screens and technical assessments to the final offer discussions. It breaks down essential topics, such as HTML, CSS, and JavaScript fundamentals, as well as more advanced areas like system design and behavioral questions. This structured content is designed not only to prepare candidates for practical interview questions but also to help them understand the full scope of a front-end developer’s role and responsibilities.
Additionally, the guide emphasizes the importance of community within the front-end development sphere. It encourages sharing and collaboration among developers to stay ahead in a rapidly evolving industry. The guidebook is available for free on frontendlead.com, reflecting a commitment to providing accessible, high-quality resources for developers at all stages of their careers. By equipping candidates with the proper knowledge and strategies, the guide aims to boost confidence and proficiency, making the daunting process of job interviews a little more manageable and successful.
Best of luck with your interviews!
