Forms
Forms follow a strict 3-file pattern per feature.
Pattern
Libraries
- React Hook Form for state and field registration.
- Zod for schema validation.
@hookform/resolvers/zodfor resolver integration.- TanStack Query for submit mutations.
Recommended implementation flow
- Define a Zod schema and inferred type.
- Build handler with
useFormanduseMutation. - Use shared
SimpleFormand form fields in page. - Call API function from feature-specific data-access modules only.
- Route on success and map API field errors when needed.
Real examples
- Simple form:
src/features/login - Auth registration form:
src/features/register - Advanced mixed-field form:
src/features/advanced-form - Drawer-based create flow:
src/features/team-members/create