bha*_*ATh 6 reactjs react-hook-form
当我使用react-hook-form时,我无法从react-hook-form解构错误对象。
const { register, handleSubmit, reset, setValue, getValues, errors, formState } = useForm({
resolver: yupResolver(validationSchema)
});
Run Code Online (Sandbox Code Playgroud)
bha*_*ATh 15
我在官方文档中找到了答案。IE
const { register, handleSubmit, reset, setValue, getValues, setError, formState: { errors }, formState } = useForm({
resolver: yupResolver(validationSchema)
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7423 次 |
| 最近记录: |