How to register a field in object without actually rendering it as input #3958
Replies: 3 comments 11 replies
-
|
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 I tried this approach, but it doesn't work. My situation is a little different. Under one set of conditions I am rendering the field in a Controller component, in another, I am not rendering it. In the later case, I am trying this approach and it's not working. The form store seems to manipulate that state, changing the state value from an instance of OrderedSet to an object, which causes my code to error further downstream. What's working for me is |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 will this work if value is dynamic. i.e. something like -
It seem not to work, as 'xxx's value is set only on the first run of useEffect [I guess subsequent values are being ignored]. What could be the solution for my case?? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How do i register a field without actually rendering as input.
For example i want to create a isDeveloper field but i do not want to render it as a input. but still i want to get the value of that field
Sandbox Link: https://codesandbox.io/s/react-hook-form-defaultvalues-v6-forked-u3k4z?file=/src/index.js
Actual Output
Expected Output
Beta Was this translation helpful? Give feedback.
All reactions