React Developer Interview Question

Walk me through Actions in React 19 and how useActionState fits in.

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

An Action is an async function you hand to React, usually through a form action prop or startTransition. React manages the pending state, errors and ordering instead of you wiring up boolean flags. useActionState takes an action and an initial state and returns the current state, a wrapped action to pass to the form, and an isPending flag. useFormStatus reads pending state from a nested component, and useOptimistic renders the expected result immediately.

Why interviewers ask this

This tells the interviewer whether you have kept current, since Actions replace a pile of boilerplate that most React codebases still carry. They want to see that you understand the pending and error handling comes from the transition machinery, and that you can explain optimistic updates and how they roll back. It is also a good proxy for whether you have shipped server side mutations recently.

How to structure your answer

  • Define an Action as an async function React manages the lifecycle of.
  • Explain what useActionState returns and where each piece goes.
  • Add useFormStatus and useOptimistic and what they solve.
  • Contrast it with the manual loading and error state you used to write.

Example answer

Spoken example, first person

Before Actions, every mutation meant the same four pieces of state: loading, error, the result, and something to stop double submits. Actions fold all of that into React. I write an async function that does the work, hand it to useActionState with an initial state, and I get back the current state, an action to put on the form's action prop, and isPending. React runs it inside a transition, so the pending flag and the ordering come for free, and if two submits race, the later result wins rather than whichever network call happens to return last. For a submit button deep inside the form I use useFormStatus so it can read pending without prop drilling. And for something like a comment box I add useOptimistic to show the comment straight away, and if the action throws, React rolls the optimistic state back to the real state on its own. The practical win is that a form component drops from about seventy lines to twenty and the edge cases stop being mine to remember.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What happens to the optimistic state if the action fails?
  • How do you surface a validation error back to the form from an action?
  • How do Actions behave before hydration finishes?

Related react developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot