Correct way to set input defaults using controller
See original GitHub issueDescribe the question?
Long story short… I’ve built the form using a smart form ish pattern. I need to set defaultValues from redux state. I’ve tried to both setting defaultValues and useEffect/reset. On the actual input I’ve set defaultValue=""
which overrides what defaultValues and reset has set. I figured I can use defaultValue on a input, so I wouldn’t have write a function to figure out everything in defaultValues upfront. I have a very large form with nested inputs. Using watch on each component was unbearable. Any way to fix this. I’m thinking I have something setup incorrectly.
To Reproduce Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/react-hook-form-controller-fbssm
- 4th input should say Josh
Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-controller-fbssm
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
How to set react hook form default values when using ...
1 Answer 1 · Set the default values for all of your inputs via an object. (Key: input's name value: input default value...
Read more >How To Set Up Controller Input In Under 3 Minutes In Unreal ...
In this video I go over how to set up controller input so we can control are character with one in are game...
Read more >WTF Is? Controller: Set Input Mode in Unreal Engine 4 ( UE4 )
What are the Controller : Set Input Mode Nodes in Unreal Engine 4Source Files: https://github.com/MWadstein/wtf-hdi-files.
Read more >Controller | React Hook Form - Simple React forms validation
You need to either set defaultValue at the field-level or useForm 's defaultValues . undefined is not a valid value. If your form...
Read more >Connect a wireless game controller to your Apple device
Open Bluetooth settings on your Apple device, then select the controller ... You can use the Buddy Controller feature to combine inputs from ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, I’ve figured out now! Sorry for the the obvious ignorance. It seems for Controlled React-number-format, it’s necessary to add the
name: value
of the field todefaultValues
.@zenzjtech it’s really simple https://codesandbox.io/s/react-hook-form-controller-079xx?file=/src/index.js