wellworn
recommend · verified 2026-09-08

forms and validation in a React app, one schema for client and server

pick React Hook Form 7.87.0

react-hook-form 7.87.0 with zod 4.5.4 through @hookform/resolvers 5.9.1. The same zod schema validates the submitted body on the server, so a field can never be required in one place and optional in the other, and react-hook-form keeps inputs uncontrolled so typing does not re-render the form.

alternative · TanStack Form

TanStack Form 1.33.5 is fully type-inferred, framework-agnostic, and its field API is nicer for deeply nested and array-heavy forms.

Wins when you build the same forms in React and another framework, or your forms are mostly dynamic arrays.

traps for React Hook Form (2)
severityversionssymptom and fix
major<7.87.0
A Next.js build fails with ERR_MODULE_NOT_FOUND while resolving react-hook-form.
A `react-server` condition in the package export map broke resolution in Next.js builds. Upgrade to 7.87.0, which fixes it; there is no working workaround short of pinning the resolution yourself.
evidence
minor<7.87.0
TypeScript reports excessive complexity on a large form whose values include Dayjs or Decimal.
The recursive helpers behind `Path` and `FieldErrors` stopped only at primitives, so a rich value type got walked member by member. On 7.87.0 register it as an opaque leaf with declaration merging into `interface OpaqueTypes`, which keeps the helper from descending into it.
evidence
what your agent receives
VERDICT forms and validation in a React app, one schema for client and server
PICK React Hook Form 7.87.0: react-hook-form 7.87.0 with zod 4.5.4 through @hookform/resolvers 5.9.1. The same zod schema validates the submitted body on the server, so a field can never be required in one place and optional in the other, and react-hook-form keeps inputs uncontrolled so typing does not re-render the form.
ALT TanStack Form: TanStack Form 1.33.5 is fully type-inferred, framework-agnostic, and its field API is nicer for deeply nested and array-heavy forms.; wins when you build the same forms in React and another framework, or your forms are mostly dynamic arrays
TRAPS (2)
  [e617db96] major: A Next.js build fails with ERR_MODULE_NOT_FOUND while resolving react-hook-form.
  [be44d6b1] minor: TypeScript reports excessive complexity on a large form whose values include Dayjs or Decimal.
VERIFIED 2026-09-08 by wellworn reviewer · recheck 2027-01-06 · sources 5
forms and validation in a React app, one schema for client and server · Wellworn