Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Conform · Pipe

lastResult

lastResult supplies useForm with the latest server submission result. Conform uses it to initialize and synchronize form state, including server-side validation feedback.

How it works

lastResult is the latest submission result returned by the server. Supplying it to useForm lets Conform use that result as the form's initial state, which supports progressive enhancement and surfaces server-side validation feedback.

Syntax

useForm({ lastResult })

Parameters

NameTypeDescription
lastResultSubmissionResult<ErrorShape> | nullThe latest server-side submission result used for form-state synchronization and progressive enhancement.

Returns

Not applicable: lastResult is an option rather than a standalone callable API.

Key points

  • The value represents the most recent form submission result, rather than arbitrary form data.
  • lastResult normally comes from server action data exposed by the application's framework.
  • Conform uses the supplied result as the form's initial state when progressively enhancing the form.
  • A typical integration obtains action data and passes it directly into the lastResult option.

Example: Synchronize server results

import { useActionData } from "react-router";
import { useForm } from "@conform-to/react";

export default function Signup() {
  const lastResult = useActionData<typeof action>();
  const [form, fields] = useForm({ lastResult });

  return (
    <form id={form.id} method="post">
      <input {...getInputProps(fields.email, { type: "email" })} />
      <button type="submit">Sign up</button>
    </form>
  );
}

Pass the server action's most recent submission result to useForm so Conform can synchronize the form with server validation state.

When to use it

Show server validation results

A server action validates submitted fields and returns errors.

Progressive enhancement

A form must work with server validation before client enhancement is available.

Connect framework action data

A framework exposes the latest action state through a hook.

Interview questions

QWhat does lastResult do?

lastResult is an option passed to useForm. It represents the latest server submission result and lets Conform initialize or synchronize the form state with server-side validation.

Follow-up: How can a Remix form avoid a reset during loader revalidation? Pass the result only when navigation or fetcher state is idle; otherwise pass null.

QWhere does lastResult usually come from?

The value normally comes from the framework's action-data mechanism, such as useActionData in Remix or useFormState in Next.js. The returned result is then supplied to useForm.

Follow-up: How does this support progressive enhancement? The server can validate and return the result even when client-side validation is absent or unavailable.

QWhy pass server results to useForm?

Conform uses the last submission result as the form's initial state for progressive enhancement. This allows server-returned errors and submission state to be reflected in the enhanced form.

Follow-up: What should be done when a loader supplies default values? Coordinate lastResult with the framework's idle state to prevent stale defaults from being applied.

  • useForm
  • SubmissionResult
  • useActionData
  • useFormState
  • form.status

Source: useForm. Checked 2026-10-15.