Should the overusage of Formprovider and useFormContext be avoided? #10786
Unanswered
philipp-merk-neuravity
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, we intend to use react-hook-form for hundreds of forms for our large application. Each form is around 10-50 fields big. I thought of reducing redundancy by creating a Wrapper for controlled and uncontrolled components:
// Controlled Component Wrapper
// Uncontrolled Component Wrapper
I did not notice unnecessary rerendering on components grouped inside of the Formprovider, if another components onChange function is being called.
I also thought of creating another Wrapper without the usage of the Formprovider where "control" and "register" would be passed as a Prop for each component, if certain limitations are met.
Would you consider this as a valid approach or should the FormProvider only be used for nested structures?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions