ワンクリックで
react-native-forms-validation
Best practices for implementing forms with React Hook Form and Zod.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Best practices for implementing forms with React Hook Form and Zod.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | React Native Forms & Validation |
| description | Best practices for implementing forms with React Hook Form and Zod. |
We use React Hook Form (RHF) and Zod to manage all form state and validation.
react-hook-form@hookform/resolvers/zodzodAlways start by defining a strict Zod schema for your form data. This provides both runtime validation and static TypeScript types.
import { z } from 'zod';
export const loginSchema = z.object({
email: z.string().email('Adresse email invalide'),
password: z.string().min(8, 'Le mot de passe doit contenir 8 caractères minimum'),
});
export type LoginFormData = z.infer<typeof loginSchema>;
Use the zodResolver to connect your schema to RHF.
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
const {
control,
handleSubmit,
formState: { errors },
} = useForm<LoginFormData>({
resolver: zodResolver(loginSchema),
defaultValues: { email: '', password: '' },
});
Because React Native does not use native HTML <form> tags, you must wrap all inputs in RHF's <Controller> component.
import { Controller } from 'react-hook-form';
<Controller
control={control}
name="email"
render={({ field: { onChange, onBlur, value } }) => (
<AppTextInput
onBlur={onBlur}
onChangeText={onChange}
value={value}
error={errors.email?.message}
/>
)}
/>;
[!WARNING] Do not use local
useStatefor form fields. Let React Hook Form manage the entire state to prevent unnecessary re-renders.
Mandatory rules and components for handling keyboard avoidance smoothly in the React Native app.
How to correctly handle and format protobuf Timestamp dates sent by the API Gateway to prevent "Invalid Date" issues.
Senior-level React Native architecture and patterns for Expo 54 apps.
Strict coding standards, naming conventions, file size limits, and typing rules.
Guidelines for managing server state, queries, and API clients in React Native.
Mandatory rule to never use deprecated APIs or ignore deprecation warnings.