React JS Interview Questions & Answers
All 200 unique questions in one place — 60 easy, 96 medium, 44 hard — grouped by topic.
Practise by topic
Practise the way your interview works
What is JSX and how does the browser understand it?
Show answer
Explain the Virtual DOM and reconciliation in React.
Show answer
What is the difference between functional components and class components?
Show answer
What are keys in React lists and why are they required?
Show answer
How do you return multiple elements from a component without adding an extra div?
Show answer
Show the common ways to do conditional rendering in React.
Show answer
What does one-way data flow mean in React?
Show answer
Your manager asks you to set up a new React project in 2026 and suggests Create React App. What would you recommend?
Show answer
You import a component and get the error 'Element type is invalid: expected a string or a class/function but got undefined'. How do you debug it?
Show answer
Write a simple counter component with increment, decrement and reset buttons.
Show answer
Tell me about a React project you built and the hardest problem you solved in it.
Show answer
React changes fast. How do you keep your skills current?
Show answer
Your team uses the array index as key in a todo list and users report that checkboxes get ticked on the wrong item after deleting a row. What is happening?
Show answer
What changed with createRoot in React 18 and later compared to ReactDOM.render?
Show answer
What are synthetic events in React?
Show answer
In development your API call inside useEffect fires twice, but only once in production. Why does this happen, and what does StrictMode do?
Show answer
Why does React prefer composition over inheritance?
Show answer
What is a Higher-Order Component and is it still used?
Show answer
What is the render props pattern?
Show answer
How do you create an error boundary in React?
Show answer
What are portals and when would you use them?
Show answer
A user types into an input inside a list row, then sorts the list, and the typed text appears in a different row. How would you fix this?
Show answer
What is automatic batching in React 18 and later?
Show answer
What is React Fiber?
Show answer
What is the difference between props and state?
Show answer
Can a child component modify its props?
Show answer
What does lifting state up mean?
Show answer
What is prop drilling and how can you avoid it?
Show answer
How do you update objects and arrays in state without mutating them?
Show answer
How do you give default values to props in a function component?
Show answer
What is the children prop?
Show answer
What is the difference between controlled and uncontrolled components?
Show answer
How does a child component send data back to its parent?
Show answer
A teammate writes user.name = 'Ravi' inside a click handler and the screen does not update. Why?
Show answer
Why should you use the functional form of setState? Show an example.
Show answer
A developer stores fullName in state and updates it in a useEffect whenever firstName or lastName changes. What would you suggest?
Show answer
On a profile edit page, when you switch from one user to another the form still shows the old user's typed values. How can you reset it cleanly?
Show answer
Your team's old codebase uses PropTypes and is upgrading to React 19. What would you recommend for checking prop types?
Show answer
How do you type props for a component in TypeScript?
Show answer
A teammate writes setCount(count + 1) three times in a click handler and is surprised that the count increases by only one. Explain why.
Show answer
Should you keep related values in one state object or several useState calls?
Show answer
A cart page keeps the selected item object in state and also the items array. After editing the item's quantity, the details panel shows the old quantity. Why?
Show answer
What are the risks of spreading all props like <Input {...props} />?
Show answer
A junior notices that every child component re-renders when the parent's state changes, even when their props did not change. How do you explain this?
Show answer
Describe a time you disagreed with a teammate about how a component should be designed.
Show answer
How does React decide whether to keep or reset a component's state?
Show answer
A timer using setInterval inside useEffect always shows 1 and never goes higher. What is the bug?
Show answer
What is state colocation and why does it matter for performance and maintainability?
Show answer
How would you update deeply nested state cleanly? Show with Immer.
Show answer
What are React hooks and what are the rules of hooks?
Show answer
How does the dependency array of useEffect control when the effect runs?
Show answer
What is useRef used for?
Show answer
What does useContext do?
Show answer
You see the error 'Rendered more hooks than during the previous render'. What is wrong?
Show answer
What is lazy initialisation in useState and when should you use it?
Show answer
What is an effect cleanup function and why is it important?
Show answer
What is the difference between useMemo and useCallback?
Show answer
When should you choose useReducer over useState? Show a small example.
Show answer
Write a custom hook to fetch data with loading and error states.
Show answer
What is useId and why not use Math.random for ids?
Show answer
What do useActionState and useFormStatus do in React 19?
Show answer
Your component fetches data in useEffect and the network tab shows thousands of requests in a loop. What could cause it?
Show answer
The linter shows a react-hooks/exhaustive-deps warning and a teammate wants to disable the rule. What do you advise?
Show answer
A developer sends an analytics event inside a useEffect that watches a 'submitted' state flag. Is this a good pattern?
Show answer
Write a useDebounce custom hook.
Show answer
A junior developer is confused about when to use useEffect. How would you explain it and help them?
Show answer
When would you use useLayoutEffect instead of useEffect?
Show answer
A search box fetches results on every keystroke and sometimes shows results for an older query. How do you fix this race condition?
Show answer
Explain useTransition and useDeferredValue.
Show answer
What is the use() API introduced in React 19?
Show answer
What is useOptimistic and when would you use it?
Show answer
What is useEffectEvent?
Show answer
How do you expose a custom method like focus() from a child to a parent in React 19?
Show answer
What is useSyncExternalStore?
Show answer
What is the Context API and when should you use it?
Show answer
Explain the core concepts of Redux.
Show answer
How do you set up a Redux store and use it in components?
Show answer
Why must Redux reducers be pure functions?
Show answer
How do you debug Redux state changes?
Show answer
What is the Flux architecture?
Show answer
What is the main performance pitfall of React Context and how do you avoid it?
Show answer
Create a Redux Toolkit slice for a counter.
Show answer
How do you handle async API calls with createAsyncThunk?
Show answer
What is RTK Query?
Show answer
What is the difference between server state and client state?
Show answer
Show how to fetch data with TanStack Query.
Show answer
What is Zustand and how do you use it?
Show answer
A new mid-sized dashboard project is starting. How would you decide between Context, Redux Toolkit and Zustand?
Show answer
Five components on one page each fetch the same user profile, causing duplicate API calls. How would you fix this?
Show answer
How do you persist part of your state, like the cart, across page reloads?
Show answer
Where should you store the logged-in user's auth token in a React app?
Show answer
What is atomic state management, as in Jotai or Recoil-style libraries?
Show answer
Tell me about a time you pushed back on adding a new library to the project.
Show answer
What is Redux middleware?
Show answer
Why normalise state in Redux and what does createEntityAdapter do?
Show answer
What are memoised selectors and why use createSelector?
Show answer
After adding an AuthContext at the root, profiling shows the whole app re-rendering every few seconds. What would you check?
Show answer
How would you implement an optimistic update with TanStack Query and roll back on failure?
Show answer
You inherit an old Redux codebase with connect, hand-written action types and switch reducers. How would you modernise it?
Show answer
What is client-side routing and how does React Router provide it?
Show answer
Show a basic React Router setup with a home page, a product page and a 404 page.
Show answer
How do you read a dynamic URL parameter like a product id?
Show answer
How do you navigate programmatically after a form submits?
Show answer
Why use Link instead of a normal anchor tag in a React app?
Show answer
How do you read and update query parameters like ?page=2&sort=price?
Show answer
What is the difference between BrowserRouter and HashRouter?
Show answer
How do you handle a form with multiple controlled inputs using one change handler?
Show answer
What are the common approaches to form validation in React?
Show answer
What are nested routes and what is the role of Outlet?
Show answer
How do you create a protected route that redirects users who are not logged in?
Show answer
What are loaders and actions in React Router?
Show answer
How do you lazy load route components to reduce the initial bundle?
Show answer
Your React app works locally, but after deployment refreshing /dashboard gives a 404 from the server. Why, and how do you fix it?
Show answer
Why is React Hook Form popular?
Show answer
Show a login form using React Hook Form with Zod validation.
Show answer
How do form Actions work in React 19?
Show answer
You are building a 4-step onboarding wizard. How do you keep data when users move back and forth between steps?
Show answer
How do you upload a file with a preview in React?
Show answer
An accessibility audit says your signup form fails screen reader checks. What would you fix to make the form accessible?
Show answer
Tell me about a time a requirement changed late in a sprint. How did you handle it?
Show answer
How would you explain to a non-technical manager why our marketing pages need server rendering?
Show answer
Describe a time you found and fixed a bug reported by a real user.
Show answer
A 60-field insurance form becomes laggy while typing because every keystroke re-renders the whole form. How would you fix it?
Show answer
Users lose their typed data when they accidentally click another menu link. How would you warn them about unsaved changes?
Show answer
What does React.memo do?
Show answer
How do you implement code splitting with React.lazy and Suspense?
Show answer
How do you optimise images in a React app?
Show answer
A developer says the app is too slow, based on testing it with the development server. What do you tell them?
Show answer
Tell me about a mistake you made that reached production and what you learned.
Show answer
What is the React Compiler?
Show answer
How do you find what is making a React page slow?
Show answer
What is list virtualisation?
Show answer
An orders table renders 10,000 rows and the page freezes on load and scroll. What would you do?
Show answer
You wrapped a row component in React.memo, but the profiler shows it still re-renders every time. The parent passes onClick={() => remove(id)}. Why?
Show answer
How do you analyse and reduce JavaScript bundle size?
Show answer
What are Core Web Vitals and how do React apps affect them?
Show answer
What is tree shaking?
Show answer
A developer writes key={Math.random()} to silence the missing key warning. What problem does this create?
Show answer
Tell me about a time you improved the performance of an application.
Show answer
How do you handle a tight deadline when you know the code is not perfect?
Show answer
Typing in a search box feels laggy because a big product list is filtered on every keystroke. How do you fix it?
Show answer
A teammate wraps every function in useCallback and every value in useMemo for performance. When should you not memoise, and what feedback would you give?
Show answer
Without using memo, what structural techniques reduce unnecessary re-renders?
Show answer
After navigating between pages for a while, the app's memory keeps growing and it slows down. How do you investigate a memory leak?
Show answer
When would you use a Web Worker in a React application?
Show answer
How do Suspense and streaming server rendering improve performance?
Show answer
What resource preloading APIs did React 19 add?
Show answer
Field data shows poor INP on the 'Add to cart' button of a product page. How do you improve it?
Show answer
After a release, the Lighthouse performance score of the home page dropped from 90 to 60. How do you find and fix the cause?
Show answer
What kinds of tests are written for a React application?
Show answer
What is the guiding philosophy of React Testing Library?
Show answer
Jest or Vitest: what is the difference for React projects?
Show answer
Write a test for a counter component that increments on click.
Show answer
What is the difference between getBy, queryBy and findBy queries?
Show answer
How do you use React DevTools for debugging?
Show answer
How do you respond when a senior developer leaves many comments on your pull request?
Show answer
A QA engineer raises a bug you believe is not a bug. How do you handle it?
Show answer
Which queries should you prefer in React Testing Library and why?
Show answer
Why is user-event preferred over fireEvent?
Show answer
How do you test a component that fetches data from an API?
Show answer
How do you mock a module in Vitest?
Show answer
How do you test a custom hook?
Show answer
Your team has hundreds of snapshot tests that developers update blindly whenever they fail. What are the drawbacks of snapshot tests and what would you suggest?
Show answer
When would you add end-to-end tests with Playwright or Cypress?
Show answer
All unit tests passed, but users found that the delete button did nothing. The tests were checking that a handleDelete function was called. What went wrong?
Show answer
How do you include accessibility checks in your React tests?
Show answer
How did you bring better testing practices to a team that had very few tests?
Show answer
Tell me about a time you had to learn a new tool or library quickly.
Show answer
How do you test a component that depends on Redux and React Router?
Show answer
Your tests pass but print 'An update to Component inside a test was not wrapped in act(...)'. What does it mean and how do you fix it?
Show answer
In a Next.js app you see a hydration mismatch error. How do you debug it?
Show answer
A test in CI fails randomly about one time in ten. How do you handle a flaky test?
Show answer
Explain the testing pyramid and the testing trophy. Which applies to frontend?
Show answer
How do you track errors that happen in production React apps?
Show answer
What is Next.js and why would you use it instead of plain React?
Show answer
What are the special files in the Next.js App Router?
Show answer
How do environment variables work in a React or Next.js app?
Show answer
Why do you want to work as a React developer?
Show answer
Explain CSR, SSR, SSG and ISR.
Show answer
What is the difference between the App Router and the Pages Router in Next.js?
Show answer
What does the 'use client' directive do?
Show answer
Show a Server Function used to handle a form in Next.js.
Show answer
How do you fetch data in a Next.js App Router page?
Show answer
What is hydration?
Show answer
How do you set SEO metadata in a Next.js App Router page?
Show answer
Your Next.js build fails with 'ReferenceError: window is not defined'. Why, and how do you fix it?
Show answer
What are the common styling options in React, and how do Server Components affect the choice?
Show answer
A blog feature must render HTML content that comes from a CMS. Why is dangerouslySetInnerHTML risky and how do you use it safely?
Show answer
During a security review you find a payment provider's secret key in the browser's JavaScript bundle. What do you do?
Show answer
How do you add multiple languages to a React app?
Show answer
Tell me about working with a backend team when an API did not match what the frontend needed.
Show answer
What are React Server Components?
Show answer
How does caching work in modern Next.js?
Show answer
What is middleware, now called proxy, in Next.js?
Show answer
An e-commerce site has one lakh product pages whose prices change a few times a day. Which rendering strategy would you choose in Next.js?
Show answer
What are micro-frontends and when are they worth it?
Show answer
How would you build and maintain a shared component library for several React apps?
Show answer
How do you write a generic, type-safe List component in TypeScript?
Show answer
Describe how you led a large frontend migration.
Show answer
Frequently asked questions
What jobs can I get after learning React JS?
You can apply for roles such as React developer, frontend developer, UI developer, MERN stack developer and Next.js developer. React is used by product startups, fintech and e-commerce companies, SaaS firms and large IT service companies working on global client projects. With some experience you can move into senior frontend, full-stack or frontend architect roles. Building two or three solid projects and a GitHub profile greatly improves your chances of getting shortlisted.
Who can learn React JS and what do I need to know first?
Students, fresh graduates from any stream, working professionals switching careers and backend developers can all learn React. You should be comfortable with HTML, CSS and core JavaScript, including functions, arrays, objects, promises and ES6 syntax like destructuring and arrow functions. If your JavaScript is weak, spend two to three weeks strengthening it first, because most React interview questions and bugs come down to JavaScript fundamentals.
How long does it take to learn React JS for a job?
With daily practice of two to three hours, most learners become comfortable with React basics in about four to six weeks and job-ready in around three months, including hooks, state management, routing, testing and Next.js. The exact time depends on your JavaScript background and how many projects you build. Consistent project work matters more than watching long tutorials, because interviews test whether you can actually build and debug features.
Is React still worth learning in 2026?
Yes. React remains the most used frontend library, with React 19, the React Compiler and frameworks like Next.js keeping it modern. Job portals in India consistently list more React openings than other frontend frameworks, especially in startups and product companies. Skills you learn, such as components, state management and TypeScript, also transfer to React Native for mobile apps and to other frameworks if you switch later.
Will I get a certificate and does it help in getting hired?
You receive a course completion certificate after finishing the training and projects. A certificate helps show structured learning on your resume and LinkedIn, but recruiters mainly judge React candidates by projects, GitHub code and interview performance. Use the certificate alongside two or three deployed projects, a clean portfolio and practice with real interview questions, which together make your profile far stronger than a certificate alone.
Should I learn Next.js and TypeScript along with React?
Yes. Most new React job descriptions mention TypeScript, and many companies build production apps with Next.js for SEO and performance. Learn plain React first so you understand components, state and hooks, then add TypeScript while building projects, and finally learn Next.js App Router and Server Components. This order avoids confusion and prepares you for both client-side React roles and full-stack Next.js roles.