/
githubmirror
/
react-hook-form
Обзор
Документация
Войти
/
githubmirror
/
react-hook-form
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/V6/disableNativeValidation.tsx
27 строк
668 B
Bill
🌐 prettier the entire code base (#5118)
10 май 2021, 10:18
Не верифицирован
10 май 2021, 10:18
10fe39d
Код
Авторство
О чём код?
import React from 'react'; import { useForm } from 'react-hook-form'; export default function App() { const { errors, handleSubmit, register } = useForm(); const onSubmit = (data) => { console.log({ data }); }; return ( <form onSubmit={handleSubmit(onSubmit)} noValidate> <label htmlFor="email">Email</label> <input name="email" type="email" ref={register({ required: 'Email is required', validate: (value) => value.includes('@') || "Email must include '@' symbol", })} /> {errors.email && errors.email.message} <input type="submit" /> </form> ); }