🌏 feature: support global error type #9746
const onSubmit = () => {
const response = await fetch(...)
if (response.statusCode > 200) {
setError('root.serverError', {
type: response.statusCode,
message: e.message,
})
}
}
const onClick = () => {
setError('root.random', {
type: 'random',
message: 'random'
})
}
return (
<>
{errors.root.serverError.type === 400 && <p>server response message</p>}
<p>{errors.root.serverError.message}</p>
<p>{errors.root.random.message}</p>
</>
)
🪜 fix set defaultValues for controlled components with values props (#9780)