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

Docs: claearErrors.mdx #9

Open
wants to merge 1 commit into
base: master-ko
Choose a base branch
from
Open
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
30 changes: 15 additions & 15 deletions src/content/docs/useform/clearerrors.mdx
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
---
title: clearErrors
description: Clear form errors
description: 폼 에러 제거
sidebar: apiLinks
---

## \</> `clearErrors:` <TypeText>(name?: string | string[]) => void</TypeText>

This function can manually clear errors in the form.
이 함수는 폼의 에러를 직접 제거할 수 있습니다.

### Props

---

| Type | Description | Example |
| ------------------------------ | ----------------------- | --------------------------------------- |
| <TypeText>undefined</TypeText> | Remove all errors. | `clearErrors()` |
| <TypeText>string</TypeText> | Remove single error. | `clearErrors("yourDetails.firstName")` |
| <TypeText>string[]</TypeText> | Remove multiple errors. | `clearErrors(["yourDetails.lastName"])` |
| Type | Description | Example |
| ------------------------------ | --------------- | --------------------------------------- |
| <TypeText>undefined</TypeText> | 모든 에러 제거. | `clearErrors()` |
| <TypeText>string</TypeText> | 단일 에러 제거. | `clearErrors("yourDetails.firstName")` |
| <TypeText>string[]</TypeText> | 여러 에러 제거. | `clearErrors(["yourDetails.lastName"])` |

- `undefined`: reset all errors
- `string`: reset the error on a single field or by key name.
- `undefined`: 모든 에러를 초기화합니다.
- `string`: 단일 필드 또는 키 이름으로 에러를 초기화합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단일과 같은 한자어보다는 하나의 필드 이런 식으로 작성하는게 어떨까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 그러네여 그게 더 나아 보입니다. ㅎㅎ

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오 한자어 지양 좋당


```javascript
register("test.firstName", { required: true })
register("test.lastName", { required: true })
clearErrors("test") // will clear both errors from test.firstName and test.lastName
clearErrors("test.firstName") // for clear single input error
clearErrors("test") // test.firstName test.lastName의 모든 에러를 제거
clearErrors("test.firstName") // 단일 입력 에러 제거
```

- `string[]`: reset errors on the given fields
- `string[]`: 주어진 필드의 오류를 초기화합니다.

<Admonition type="important" title="Rules">
<Admonition type="important" title="규칙">

- This will not affect the validation rules attached to each inputs.
- This method doesn't affect validation rules or `isValid` formState.
- 이 메소드는 각 입력 필드에 연결된 유효성 검사 규칙에는 영향을 주지 않습니다.
- 이 메소드는 유효성 검사 규칙이나 `isValid` formState에는 영향을 미치지 않습니다.

</Admonition>

Expand Down