What's the use of ref option for register method #10933
Replies: 3 comments
-
@bluebill1049 @Moshyfawn |
Beta Was this translation helpful? Give feedback.
-
I guess you could extract the ref from register and merge it with yours before passing it to the form field. import mergeRefs from "merge-refs"
// ...code
const { ref, ...rest } = register("name")
const myRef = useRef()
return <input {...rest} ref={mergeRefs(ref, myRef)} /> |
Beta Was this translation helpful? Give feedback.
-
@Dragate Thanks for sharing your opinion. But the given code block does not use the register method option |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've looked into RHF documentation here : https://react-hook-form.com/docs/useform/register#options
ref
description or code example seems incomplete, any one please describe.Beta Was this translation helpful? Give feedback.
All reactions