File size: 4,971 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<div align="center">
    <p align="center">
        <a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation">
            <img src="https://raw.githubusercontent.com/bluebill1049/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" width="300px" />
        </a>
    </p>
</div>

<p align="center">์œ ์—ฐํ•˜๊ณ  ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ์‚ฌ์šฉํ•˜๊ธฐ ์‰ฌ์šด ๊ณ ์„ฑ๋Šฅ ํผ ๊ฒ€์ฆ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ</p>

<div align="center">

[![npm downloads](https://img.shields.io/npm/dm/react-hook-form.svg?style=for-the-badge)](https://www.npmjs.com/package/react-hook-form)
[![npm](https://img.shields.io/npm/dt/react-hook-form.svg?style=for-the-badge)](https://www.npmjs.com/package/react-hook-form)
[![npm](https://img.shields.io/bundlephobia/minzip/react-hook-form?style=for-the-badge)](https://bundlephobia.com/result?p=react-hook-form)
[![Coverage Status](https://img.shields.io/coveralls/github/bluebill1049/react-hook-form/master?style=for-the-badge)](https://coveralls.io/github/bluebill1049/react-hook-form?branch=master)

[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=React+hooks+for+form+validation+without+the+hassle&url=https://github.com/bluebill1049/react-hook-form)&nbsp;[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/react-hook-form)

</div>

<div align="center">
    <p align="center">
        <a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation">
            <img src="https://raw.githubusercontent.com/bluebill1049/react-hook-form/master/docs/example.gif" alt="React Hook Form video - React custom hook for form validation" width="100%" />
        </a>
    </p>
</div>

<a href="./README.V6.md">English</a> | <a href="./README.zh-TW.md">็นไธญ</a> | <a href="./README.zh-CN.md">็ฎ€ไธญ</a> | <a href="./README.ja-JP.md">ๆ—ฅๆœฌ่ชž</a> | ํ•œ๊ตญ์–ด | <a href="./README.fr-FR.md">Franรงais</a> | <a href="./README.it-IT.md">Italiano</a> | <a href="./README.pt-BR.md">Portuguรชs</a> | <a href="./README.es-ES.md">Espaรฑol</a> | <a href="./README.ru-RU.md">ะ ัƒััะบะธะน</a> | <a href="./README.de-DE.md">Deutsch</a> | <a href="./README.tr-TR.md">Tรผrkรงe</a>

## ํŠน์ง•

- ์„ฑ๋Šฅ๊ณผ DX๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ตฌ์ถ•
- ์ œ์–ด๋˜์ง€ ์•Š๋Š” ์–‘์‹ ๊ฒ€์ฆ
- ์ œ์–ด ๋œ ์–‘์‹์˜ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ต๋‹ˆ๋‹ค
- ์˜์กด์„ฑ ์—†๋Š” [์ž‘์€ ์šฉ๋Ÿ‰](https://bundlephobia.com/result?p=react-hook-form@latest)
- HTML ํ‘œ์ค€์„ ๋”ฐ๋ฅด๋Š” ๊ฒ€์ฆ
- React Native ์™€ ํ˜ธํ™˜
- [Yup](https://github.com/jquense/yup), [Joi](https://github.com/hapijs/joi), [Superstruct](https://github.com/ianstormtaylor/superstruct) ๋˜๋Š” custom ์ง€์›
- ๋ธŒ๋ผ์šฐ์ € ๋„ค์ดํ‹ฐ๋ธŒ ๊ฒ€์ฆ ์ง€์›
- [Form Builder](https://react-hook-form.com/form-builder)๋กœ ํผ ๋น ๋ฅด๊ฒŒ ์ƒ์„ฑ

## ์„ค์น˜

    $ npm install react-hook-form

## ๋งํฌ

- [๋งŒ๋“ค๊ฒŒ๋œ ๋™๊ธฐ](https://medium.com/@bruce1049/form-validation-with-hook-in-3kb-c5414edf7d64)
- [๋น„๋””์˜ค ํŠœํ† ๋ฆฌ์–ผ](https://www.youtube.com/watch?v=-mFXqOaqgZk&t)
- [์‹œ์ž‘ํ•˜๊ธฐ](https://react-hook-form.com/get-started)
- [API](https://react-hook-form.com/docs)
- [์˜ˆ์ œ](https://github.com/bluebill1049/react-hook-form/tree/master/examples)
- [๋ฐ๋ชจ](https://react-hook-form.com)
- [Form Builder](https://react-hook-form.com/form-builder)
- [FAQs](https://react-hook-form.com/faqs)

## ์‹œ์ž‘ํ•˜๊ธฐ

```jsx
import React from 'react';
import { useForm } from 'react-hook-form';

function App() {
  const { register, handleSubmit, errors } = useForm(); // initialise the hook
  const onSubmit = (data) => {
    console.log(data);
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input name="firstname" ref={register} /> {/* register an input */}
      <input name="lastname" ref={register({ required: true })} />
      {errors.lastname && 'Last name is required.'}
      <input name="age" ref={register({ pattern: /\d+/ })} />
      {errors.age && 'Please enter number for age.'}
      <input type="submit" />
    </form>
  );
}
```

## ๊ธฐ์—ฌ์ž

๋ชจ๋“  ๊ธฐ์—ฌ์ž ๋ถ„๋“ค๊ป˜ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! [[๊ธฐ์—ฌํ•˜๊ธฐ](../CONTRIBUTING.md)]

<a href="https://github.com/react-hook-form/react-hook-form/graphs/contributors">
    <img src="https://opencollective.com/react-hook-form/contributors.svg?width=950" />
</a>

## ์กฐ์ง

์ด ํ›Œ๋ฅญํ•œ ์กฐ์ง์— ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค! [[๊ธฐ์ฆํ•˜๋‹ค](https://opencollective.com/react-hook-form/contribute)]

<a href="https://github.com/react-hook-form/react-hook-form/graphs/contributors">
    <img src="https://opencollective.com/react-hook-form/organizations.svg?width=950" />
</a>

## ํ›„์›์ž

๋ชจ๋“  ํ›„์›์ž ๋ถ„๋“ค๊ป˜ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! [[ํ›„์›ํ•˜๊ธฐ](https://opencollective.com/react-hook-form#backer)]

<a href="https://opencollective.com/react-hook-form#backers">
    <img src="https://opencollective.com/react-hook-form/backers.svg?width=950" />
</a>