onSubmit mode
In this example, client-side validations will happen only when the user submits the form. For performance reasons, that's our default behavior.
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="onSubmit" />
onSubmit mode
In this example, client-side validations will happen only when the user submits the form. For performance reasons, that's our default behavior.
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="onSubmit" />