Next Schema Once Signup
Use withZod once and let the hook infer validation + types across client and server.
Impact
Alto
Differential
Single schema lifecycle with no duplicated contract.
Message
Schema unica, validação em ambos os lados.
export const signupAction = withZod(signupSchema, async (data) => {
// data is inferred from schema
return await createUser(data);
});
const form = useActionForm(signupAction, {
defaultValues: { username: "", email: "", password: "" },
validationMode: "onChange",
});