react-hook-form / documentation

📋 Official documentation
http://react-hook-form.com
MIT License
726 stars 1.04k forks source link

Add section on behaviour of values prop in combination with defaultValues prop #1069

Closed maurer2 closed 6 months ago

maurer2 commented 6 months ago

Hello, it might be helpful to clarify how values and defaultValues work when both props are used with the useForm hook. This behaviour seems to have tripped up another user before. I observed the behaviour when using defaultData to store default values and values for storing the latest form values that were previously submitted. When trying to reset the form via reset or resetting the field via resetField values would be used as default values instead of defaultValues unless resetOptions: { keepDefaultValues: true } was used.

Cheers

vercel[bot] commented 6 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hook-form-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 4:25am