Native-first form submission
A form must remain submittable while JavaScript is unavailable or still loading.
Conform · Const
Conform's progressive enhancement keeps HTML forms functional without depending on JavaScript, then layers on client-side behavior when available. It can preserve submission state and validation feedback across server responses and reloads.
Conform treats progressive enhancement as a native-form-first approach: the browser can submit the HTML form before JavaScript is available, while Conform progressively adds client behavior. The server's last submission can initialize the form again, and FormStateInput preserves additional state across reloads.
import { FormStateInput } from '@conform-to/react';
export function ContactForm({ form, fields }) {
return (
<form id={form.id} method="post">
<FormStateInput formId={form.id} />
<label htmlFor={fields.email.id}>Email</label>
<input {...fields.email} type="email" />
<button type="submit">Send</button>
</form>
);
}Render the hidden state input alongside the form so Conform can restore validation state after a document reload.
A form must remain submittable while JavaScript is unavailable or still loading.
A dynamic field list changes through a server round trip.
Users may encounter temporary network failures or need robust keyboard and assistive-technology support.
Progressive enhancement means the form remains usable through native HTML submission, while Conform adds validation and state synchronization when JavaScript runs. The hook can use the server's last submission as the initial form state.
Follow-up: How would you preserve state across a reload caused by a non-submit intent? Render FormStateInput so Conform can restore the form state and errors.
Use useForm to create form and field metadata, then apply that metadata to a normal HTML form and its controls. The browser still owns the fundamental submission path, and Conform enhances it with client behavior.
Follow-up: How can validation begin without client-side validation? Use native constraint attributes and server validation; Conform also supports live validation without client validation.
FormStateInput renders a hidden input containing form state needed to reconstruct the form after a document reload. This is useful when an action such as adding a list item causes navigation or reload and otherwise loses errors from other fields.
Follow-up: What state source initializes a form after the server responds? Pass the server's last submission through useForm's lastResult option.
useFormFormStateInputlastResultdefaultNoValidateFormData Web API