์ ์ฐํ๊ณ ํ์ฅ ๊ฐ๋ฅํ ์ฌ์ฉํ๊ธฐ ์ฌ์ด ๊ณ ์ฑ๋ฅ ํผ ๊ฒ์ฆ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
English | ็นไธญ | ็ฎไธญ | ๆฅๆฌ่ช | ํ๊ตญ์ด | Franรงais | Italiano | Portuguรชs | Espaรฑol | ะ ัััะบะธะน | Deutsch | Tรผrkรงe
ํน์ง
- ์ฑ๋ฅ๊ณผ DX๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ตฌ์ถ
- ์ ์ด๋์ง ์๋ ์์ ๊ฒ์ฆ
- ์ ์ด ๋ ์์์ ์ฑ๋ฅ์ ํฅ์์ํต๋๋ค
- ์์กด์ฑ ์๋ ์์ ์ฉ๋
- HTML ํ์ค์ ๋ฐ๋ฅด๋ ๊ฒ์ฆ
- React Native ์ ํธํ
- Yup, Joi, Superstruct ๋๋ custom ์ง์
- ๋ธ๋ผ์ฐ์ ๋ค์ดํฐ๋ธ ๊ฒ์ฆ ์ง์
- Form Builder๋ก ํผ ๋น ๋ฅด๊ฒ ์์ฑ
์ค์น
$ npm install react-hook-form
๋งํฌ
์์ํ๊ธฐ
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>
);
}
๊ธฐ์ฌ์
๋ชจ๋ ๊ธฐ์ฌ์ ๋ถ๋ค๊ป ๊ฐ์ฌํฉ๋๋ค! [๊ธฐ์ฌํ๊ธฐ]
์กฐ์ง
์ด ํ๋ฅญํ ์กฐ์ง์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! [๊ธฐ์ฆํ๋ค]
ํ์์
๋ชจ๋ ํ์์ ๋ถ๋ค๊ป ๊ฐ์ฌํฉ๋๋ค! [ํ์ํ๊ธฐ]