React Interview Questions and Live Coding Help

Practice explaining hooks, effects and state, then build a support queue and handle the follow-ups. When a React interview moves from a spoken question to a code snippet, Hiintly can suggest an explanation or approach from the audio or a screenshot.

React interview questions and answers

A technical screen may ask you to explain what happens when someone clicks a button, changes a filter or navigates away. Start your answer with what appears on screen, then trace it to the state, props or effect that caused it.

Why does calling the setter twice sometimes add only one?

An event handler sees the state from the render that created it. If count is 0, two calls to setCount(count + 1) both request 1. When each change depends on the previous value, call setCount(previous => previous + 1) twice. React applies the queued updates in order, so the result is 2.

When do you actually need useEffect?

Use an effect to synchronize with something outside React, such as a subscription tied to the current room ID. Unsubscribe when the room changes or the component unmounts. A list filtered from existing props and state can be calculated during render. Putting that list in an effect adds another update and gives the source data and its copy a chance to disagree.

The React guide to removing unnecessary effects shows how to tell these cases apart.

What makes a form field controlled?

React state supplies the field’s value, and its change handler updates that state. This lets a parent reset the field or use the same value to drive another component. An uncontrolled field can start with defaultValue and keep its current value in the DOM. It can be simpler if you only need to read it when the form is submitted.

Why might a React component render again?

A component can render again after a state change, an update to context it reads, or a render of its parent. Rendering means React calls the component to calculate its output. The browser DOM only needs to change where the resulting UI differs, so seeing another render is not proof of a slow page.

What does a custom hook share?

A custom hook shares logic. Two components calling a hook that contains useState each get their own state. If both must read and update the same value, lift that state to a common owner or have both subscribe to the same source.

How do you fix an effect that sees an old value?

Find which render created the callback. An interval started by an effect with no dependencies can keep reading the initial count. If the interval only needs to increment, use the functional setter so the callback does not read count. If an external subscription needs the current room ID, use that ID as a dependency and clean up the old subscription.

To rehearse a follow-up with Hiintly, read the question aloud and send it from the transcript. If the interviewer shows code, capture the snippet and ask what it renders before asking for a fix. For example: “Why does the interval still log the first count?”

React coding interview exercise: build a support queue

The interviewer gives you an array of support tickets with unique IDs, titles and statuses. Show the tickets, add an “open only” filter and display the details for the selected ticket. Keep the details open if that ticket is filtered out. A refresh may reorder the tickets or replace their data.

Implement the queue

import { useState } from 'react';

export default function TicketQueue({ tickets }) {
  const [openOnly, setOpenOnly] = useState(false);
  const [selectedId, setSelectedId] = useState(null);

  const visible = openOnly
    ? tickets.filter(ticket => ticket.status === 'open')
    : tickets;
  const selected = tickets.find(ticket => ticket.id === selectedId);

  return (
    <>
      <label>
        <input
          type="checkbox"
          checked={openOnly}
          onChange={event => setOpenOnly(event.target.checked)}
        />
        Show open tickets only
      </label>

      {visible.length === 0 ? <p>No matching tickets.</p> : (
        <ul aria-label="Tickets">
          {visible.map(ticket => (
            <li key={ticket.id}>
              <button
                type="button"
                aria-pressed={ticket.id === selectedId}
                onClick={() => setSelectedId(id =>
                  id === ticket.id ? null : ticket.id
                )}
              >
                {ticket.title}
              </button>
            </li>
          ))}
        </ul>
      )}

      <section aria-label="Ticket details">
        <h2>Ticket details</h2>
        <p>{selected ? selected.title : 'Select a ticket.'}</p>
      </section>
    </>
  );
}

Store the choices the user makes

The filter and selection are user choices, so keep them in state. The visible list and selected ticket can be calculated from those choices and the current props. This way, a refreshed ticket title appears without having to sync a stored copy. If you split the queue into a toolbar, list and details pane, let their closest common parent own the values they share. See the React guide to sharing state.

Check what the user sees

Select a closed ticket, then turn on the open filter.
Its row disappears. Its details stay because the details pane looks at all tickets, independent of the filter.
Reorder the list, or refresh it with a new title for the selected ID.
Selection still points to the same ticket and the details use the new title. Neither depends on array position or a stored copy of the ticket.
Remove the selected ticket from the incoming data.
The details show “Select a ticket.” If nothing matches the filter, the list shows “No matching tickets.” These are independent outcomes.

Follow-up: only show details for visible tickets

Derive the details from visible instead of tickets. Clarify what happens when the filter turns off again. Keeping the selected ID lets the details return. If hiding a ticket should clear its selection for good, clear it in the same filter change handler.

Give Hiintly the changed requirement

Capture the code around the filter and selection, then include the follow-up from the transcript or type it: “Hide details when the ticket is filtered out. Restore them when the filter turns off.” That lets Hiintly suggest a change for the intended behavior. Use the editor to check the sequence of selecting, hiding and restoring the ticket.

React questions for experienced developers

In a project discussion, an interviewer may ask why you changed a component boundary, removed an effect or chose where to keep shared state. Pick a React feature you worked on. Explain what was going wrong, what you investigated and how you confirmed that the change helped. Give Hiintly your resume and job description as context for spoken follow-ups, then use your own evidence when you answer.

If your loop also covers CSS, accessibility and browser debugging, use the frontend developer interview guide to prepare for those rounds.

Which state would you keep local as the app grows?

A draft note belongs with the editor if nothing else uses it. If the queue and details need the same selection, their closest common parent can own it. If back navigation and shared links need to restore the open ticket, consider making its ID part of the URL and reading it from there. Explain which behavior justifies the change.

How would you diagnose a slow queue?

Reproduce the slow click or filter with realistic data and profile the interaction. If expensive filtering dominates, change the computation or memoize it when the inputs are stable. If mounting thousands of rows dominates, consider rendering only the visible window. Repeat the same interaction to check what improved.

How would you prove a state bug is fixed?

Describe a failing sequence a user can reproduce. Start saving a ticket note, open a different ticket before the request finishes and resolve the first save. Check that the second ticket doesn’t show “Saved” for the first ticket’s note. A regression test can control the response timing and verify the visible result.

When should changing a key reset state?

Keep each ticket row keyed by its ticket ID so a reorder preserves its identity. If switching workspaces should reset the entire queue, key the queue by the workspace ID. React recreates the queue and clears its local filter, selection and child state. If the filter should survive, keep it above that keyed boundary. The React guide to preserving and resetting state explains why the two uses of keys work.

Use Hiintly for your React interview

Choose Coding Interview and add any known constraints in Extra Instructions, such as React with TypeScript, no external libraries, or a requirement to explain the behavior before changing the code. A free 10-minute session is enough to try a question and its follow-up, with no credit card required.

  • For spoken questions: Send the question from the transcript. Ask for an explanation that connects the React behavior to what the user sees.

  • For an editor prompt: Capture the relevant JSX, test failure or prompt. Include expected behavior if it’s outside the screenshot.

Hiintly desktop app showing a coding suggestion

React interview FAQ

What React interview questions should I practice first?

Start with questions that ask you to predict behavior: What shows after two state updates? Does this filtered list need an effect? Which item keeps its input when the list is reordered? For each, name the cause and one action that would verify your answer.

What kind of React coding exercise should I expect?

You might build or extend a form, list, modal or small data-driven view. Practice clarifying the required states before writing code. For a data-backed UI, also ask what users should see while it loads, if it fails, and if it returns no results.

What should experienced React developers prepare for?

Prepare for follow-ups about data ownership, performance and how you verified a fix. Bring a real example with a constraint, such as keeping a list usable with a large dataset. Explain the option you rejected, why you chose the other and the evidence that it helped.

Should I prepare for React interviews with JavaScript or TypeScript?

Use the language the role or interviewer specifies. If it is TypeScript, rehearse the same interactions with typed props and events, including how a component represents loading, error and success. The choice of language does not change who should own the selected ticket.

Can Hiintly help with a React prompt shown in a shared editor?

Yes. Capture a screenshot of the prompt or relevant JSX and send it to Hiintly. For a spoken follow-up, send the transcribed question or type the changed requirement. Hiintly can suggest an approach or explain the code; run it in your editor to check the behavior.