npm react-hook-form 7.43.0-next.0
Version 7.43.0-next.0

latest releases: 7.53.2, 7.53.1, 7.53.0...
22 months ago

🌏 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)

Don't miss a new react-hook-form release

NewReleases is sending notifications on new releases.