Interview Q&A · questions with model answers

React Developer Interview Questions

Part of the study plan for: Frontend Engineer · Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked Explain React concept: JSX.

    JSX is a JavaScript syntax extension that describes React elements with XML-like markup.

  2. Most asked Explain React concept: props.

    Props are read-only inputs passed from a parent component to a child component.

  3. Most asked Explain React concept: state.

    State is component-owned data that can change over time and cause React to re-render the UI.

  4. Most asked Explain React concept: unidirectional data flow.

    React data generally flows down from parent to child through props, while events flow up through callbacks.

  5. Most asked Explain React concept: keys in lists.

    Keys give React stable identity for list items during reconciliation.

  6. Most asked Explain React concept: lifting state up.

    Lifting state up means moving state to the closest common parent that needs to coordinate multiple children.

  7. Most asked Explain React concept: reconciliation.

    Reconciliation is React's process for comparing the previous and next element trees and deciding what UI updates are needed.

  8. Most asked React performance: React.memo?

    React.memo memoizes a component render result so React can skip re-rendering when props are equal.

  9. Explain React concept: components.

    Components are reusable units that receive inputs and return UI.

  10. Discuss testing-library in React applications.

    Testing Library encourages tests that interact with components the way users do, focusing on accessible output and behavior.

  11. Discuss accessibility (a11y) in React applications.

    Accessibility in React means building components that work with keyboard navigation, screen readers, semantic HTML, focus management, and sufficient visual contrast.

  12. How do Actions and `useActionState` work in React 19?

    An Action is an async function used in a transition (e.g., passed to <form action={fn}>). useActionState(action, initialState) returns [state, dispatch, isPending]: React runs the action when the…

  13. Explain React concept: derived state anti-pattern.

    Derived state is an anti-pattern when you copy values from props or other state into state without a real synchronization need.

  14. Explain React concept: pure components.

    A pure component returns the same UI for the same props and state and avoids side effects during render.

  15. Explain React concept: error boundaries.

    Error boundaries catch rendering lifecycle errors below them and render fallback UI instead of crashing the whole tree.

  16. Explain React concept: Suspense.

    Suspense lets components wait for asynchronous dependencies and show a fallback while the dependency is pending.

  17. Explain React concept: lazy / code splitting.

    React.lazy and dynamic imports split code so parts of the app load only when needed.

  18. React performance: virtualization?

    Virtualization renders only the visible portion of a large list or grid instead of every item.

  19. React performance: profiling?

    React profiling measures where rendering time is spent so optimization targets real bottlenecks.

  20. Discuss React Router in React applications.

    React Router maps URLs to UI, nested route layouts, navigation, params, and route-aware data patterns.

  21. Discuss TanStack Query in React applications.

    TanStack Query manages server state: fetching, caching, deduping, retries, invalidation, and background refresh.

  22. Discuss Vitest/Jest in React applications.

    Vitest and Jest are JavaScript test runners commonly used for React unit and component tests.

  23. Discuss Next.js in React applications.

    Next.js is a React framework for routing, server rendering, static generation, API/server functions, and production deployment patterns.

  24. Discuss forms in React applications.

    React forms manage user input, validation, submission, errors, and server interaction through controlled, uncontrolled, or library-assisted approaches.

  25. Discuss auth patterns in React applications.

    React auth patterns coordinate identity, token/session storage, protected routes, API calls, refresh, logout, and authorization-aware UI.

  26. How does `useOptimistic` implement optimistic UI?

    useOptimistic(state, updateFn) returns an optimistic copy of state and a setter. Calling the setter inside an Action/transition immediately shows the expected result (e.g., a new message marked…

  27. How did refs change in React 19?

    Function components can now receive ref as a normal prop, so forwardRef is no longer necessary (it will be deprecated). Ref callbacks can return a cleanup function, called when the element is removed.

  28. How does TanStack Query manage server state?

    It caches query results by key, deduplicates concurrent requests, refetches stale data (on window focus, reconnect, intervals), retries failures, supports pagination/infinite queries, and handles…

  29. How do server-side rendering and hydration work in React?

    The server renders components to HTML (renderToPipeableStream/renderToReadableStream) for fast first paint and SEO; the client then calls hydrateRoot, which attaches event handlers and reconciles…

  30. How should React components be tested?

    Use React Testing Library to test behavior the way users interact: query by role/label/text, simulate interactions with @testing-library/user-event, assert on visible outcomes, mock network with…

  31. What happens in the browser from navigation until a React page shows its data, and how do you avoid request waterfalls?

    The browser fetches the HTML, downloads CSS and JavaScript, React renders the app (or hydrates server-rendered HTML), effects run after render and often start data requests, and the components…

  32. Explain React concept: fragments.

    Fragments let a component return multiple sibling elements without adding an extra DOM node.

  33. Explain React concept: portals.

    Portals render children into a DOM node outside the parent component's DOM hierarchy while preserving React ownership.

  34. Explain React concept: Strict Mode.

    Strict Mode is a development-only tool that helps reveal unsafe render logic, missing cleanup, and deprecated patterns.

  35. Explain React concept: Server Components (RSC).

    React Server Components render on the server and send a component payload to the client without shipping their component code to the browser.

  36. React performance: avoid inline object props?

    Avoiding inline object props can help memoized children because new object literals have new identity every render.

  37. React performance: key remounting?

    Changing a component's key tells React to treat it as a different instance, which remounts the subtree and resets local state.

  38. React performance: batching?

    Batching groups multiple state updates into a single render for better performance and consistency.

  39. React performance: concurrent features?

    Concurrent React features let React interrupt, prioritize, and resume rendering work to keep the UI responsive.

  40. React performance: bundle analysis?

    Bundle analysis identifies what code ships to the browser and how large each dependency or chunk is.

  41. Discuss CSS modules / Tailwind in React applications.

    CSS Modules scope authored CSS by component, while Tailwind provides utility classes for styling directly in markup.

  42. How does React 19 handle `<title>`, `<meta>` and stylesheets rendered in components?

    React 19 hoists <title>, <meta> and <link> tags rendered anywhere in the tree into the document <head>, and supports <link rel="stylesheet" precedence="..."> with deduplication and ordering, plus…

  43. How does React's event system work?

    React attaches listeners at the root container (event delegation) and dispatches 'synthetic' events that wrap native events with a consistent cross-browser interface; handlers are registered via…

  44. How do XSS risks show up in React apps?

    React escapes text in JSX, but XSS can still occur through dangerouslySetInnerHTML with unsanitized HTML, user-controlled href/src values (javascript: URLs), injecting into <script> or style…

  45. How do error boundaries interact with async errors and event handlers?

    Error boundaries catch errors thrown during rendering, lifecycle methods and constructors in their subtree, but not errors in event handlers, async code (setTimeout, promises) or SSR. Handle those…

  46. How should a React SPA handle authentication tokens securely?

    Prefer HttpOnly, Secure, SameSite cookies managed by the backend (or a BFF) so JavaScript can't read tokens; if you must use bearer tokens, keep access tokens in memory with short lifetimes and…

  47. How do class component lifecycle methods map to hooks?

    componentDidMount/componentDidUpdate/componentWillUnmount map to useEffect with dependencies and cleanup; shouldComponentUpdate maps to React.memo; getDerivedStateFromProps is usually replaced by…

  48. In an RSC app, how do you decide what should be a Client Component?

    Only components needing interactivity (state, effects, event handlers), browser APIs, or client-only libraries should be Client Components; keep data fetching and static rendering on the server, and…

  49. How does automatic batching work in React 18+?

    React batches multiple state updates into a single re-render everywhere: in event handlers, promises, timeouts and native event handlers (before 18, only React event handlers were batched).

  50. How does useEffect work in functional React components?

    useEffect runs side effects after render.

Was this page helpful?

Report a mistake