React-hook-form: <Controller>'s control prop should be optional (useFormContext)

Created on 29 Dec 2019  路  3Comments  路  Source: react-hook-form/react-hook-form

Is your feature request related to a problem? Please describe.
<Controller> component has to have control prop defined, even when using <FormContext>. Maybe it would be possible to use const { control } = useFormContext() in case there is no control prop directly passed?

Describe the solution you'd like
I'd love to don't repeat myself and use clean and clear <Controller> component without passing additional control each and every time.

Describe alternatives you've considered
Previously, React Hook Form input worked as described above.

Additional context
https://github.com/react-hook-form/react-hook-form-input/blob/master/src/index.tsx#L55-L58

enhancement

All 3 comments

That was quick, thank you very much @bluebill1049!

pleasure @kusmierz I am working on RHF, may as well as get this one in.

should be on the next minor release.

Was this page helpful?
0 / 5 - 0 ratings