Check out our talk at Remix Conf!

onChange mode

In this example, client-side validations will happen every time the value of a field changes and the submit button will only be enabled if the form is valid.

const schema = z.object({
  firstName: z.string().min(1),
  email: z.string().min(1).email(),
})

const mutation = makeDomainFunction(schema)(async (values) => values)

export const action: ActionFunction = async ({ request }) =>
  formAction({ request, schema, mutation })

export default () => <Form schema={schema} mode="onChange" />