Skip to content

Unnecessary formHook Prop Passing in Form Fields – FormProvider Handles control Automatically #1

@SergeiPleshko

Description

@SergeiPleshko

Hello!

I noticed that in the MainForm component, you are using FormProvider file. According to the official Controller documentation https://react-hook-form.com/docs/usecontroller/controller, the control object is obtained from useForm, but it is optional when using FormProvider.

Currently, the formHook (which contains control) is being explicitly passed to form fields, even though Controller can automatically retrieve control from FormProvider. This results in unnecessary prop drilling and additional complexity in the code.

Correct me if I'm wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions