Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseWithYup.md translated to Japanese. #37

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/ja/api/yup/parseWithYup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# parseWithYup

指定された yup スキーマを使用してフォームデータを解析し、送信内容の概要を返すヘルパーです。

```tsx
const submission = parseWithYup(payload, options);
```

## パラメーター

### `payload`

フォームの送信方法に応じて、 **FormData** オブジェクトまたは **URLSearchParams** オブジェクトのいずれかになります。

### `options`

#### `schema`

Yup スキーマ、または Yup スキーマを返す関数のいずれかです。

#### `async`

**validateSync** の代わりにyupスキーマから **validate** メソッドを使用してフォームデータを解析したい場合は、 **true** に設定してください。

## 例

```tsx
import { parseWithYup } from '@conform-to/zod';
import { useForm } from '@conform-to/react';
import * as yup from 'zod';

const schema = yup.object({
email: yup.string().email(),
password: yup.string(),
});

function Example() {
const [form, fields] = useForm({
onValidate({ formData }) {
return parseWithYup(formData, { schema });
},
});

// ...
}
```