`useFormContext` should be available through children
See original GitHub issueSince we are using react-hook-form. It would be nice to have access to stuff like isSubmitting
from the form children without having to pass it down the three.
Right now, the form is controlling the label of the button to indicate the form is submiting but if you are working with UI libs like Chakra, you might want to use somethnig like <Button isLoading />
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (11 by maintainers)
Top Results From Across the Web
useFormContext - Simple React forms validation
Performant, flexible and extensible forms with easy-to-use validation.
Read more >React Hook Form with Children in React Native - Stack Overflow
In your child component, define useFormContext() and de-structure your props; Get access to the field methods like onChange, onBlur, value by ...
Read more >useFormContext returns null · Discussion #3894 · react-hook ...
Hi. i have some internal library where i created few components based on react-hook-form@5.7.2. everything was ok when i build library in ...
Read more >Advanced Usage - Simple React forms validation
React Hook Form will validate your input data against the schema and return with either errors or a valid result. Step 1: Install...
Read more >Using React Hook Form in component tests | by Adam J. Arling
Recently we transitioned our React Hook Form implementations and child components to use useFormContext. Since we're gravitating towards using our own ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It took me some time, but I finally understood this issue 😅
If we always render a FormProvider inside our forms, it will enable the users to useFormContext anywhere inside any form. The solution is simple and looks harmless. I’ll reopen the issue until we implement it.
Released on v1.3.0. Thanks for the PR, @bvangraafeiland 💪🏼 🎉