From ea9363cebaf302a9d7062b04d06aac378aeece94 Mon Sep 17 00:00:00 2001 From: Coji Mizoguchi Date: Sat, 2 Mar 2024 14:06:53 +0000 Subject: [PATCH] Translate getYupConstraint.md via GitLocalize --- docs/ja/api/yup/getYupConstraint.md | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/ja/api/yup/getYupConstraint.md diff --git a/docs/ja/api/yup/getYupConstraint.md b/docs/ja/api/yup/getYupConstraint.md new file mode 100644 index 00000000..cb22d675 --- /dev/null +++ b/docs/ja/api/yup/getYupConstraint.md @@ -0,0 +1,34 @@ +# getYupConstraint + +Yupスキーマをイントロスペクトすることで、各フィールドの検証属性を含むオブジェクトを返すヘルパーです。 + +```tsx +const constraint = getYupConstraint(schema); +``` + +## パラメーター + +### `schema` + +イントロスペクトされるべき Yup スキーマです。 + +## 例 + +```tsx +import { getYupConstraint } from '@conform-to/yup'; +import { useForm } from '@conform-to/react'; +import * as yup from 'yup'; + +const schema = yup.object({ + title: yup.string().required().min(5).max(20), + description: yup.string().optional().min(100).max(1000), +}); + +function Example() { + const [form, fields] = useForm({ + constraint: getYupConstraint(schema), + }); + + // ... +} +```