[Docs question] useForm
See original GitHub issueAre you submitting a bug report or a feature request?
Question about the documentation
What is the current behavior?
The doc states:
The useForm hook plucks the FormApi out of the React context for you. It will throw an exception if you try to use it outside of a <Form> component.
Which confused me at first, because what would be the use of useForm
if you still needed Form
?
Then I found this Codesandbox: https://codesandbox.io/s/zqkj5706y3, which doesn’t use Form
.
I think the doc should be updated, and I would gladly do it but maybe I’m mistaken, or maybe there was some intent behind the original description?
Thanks in advance for looking into it!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
useForm | React Hook Form - Simple React forms validation
useForm is a custom hook for managing forms with ease. It takes one object as optional argument. The following example demonstrates all of...
Read more >Choose a question for your form - Google Docs Editors Help
You can include up to 2000 total choices and collect several types of answers in your form or quiz. Learn how to add...
Read more >Tech Tip # 86 - Create a google form that automatically fills ...
This video demonstrates how you can create a google form that pulls question choices from a spreadsheet and eliminates them as form choices ......
Read more >How to build Google Forms from the contents of Google Docs?
Form Builder for Docs ” helps you to build Google Forms in a very simple and ... loading contents from existing Google Docs...
Read more >Form Builder - Video 3 - Import From Google Docs - YouTube
Import fields, questions and answers from Google Document straight into Google Forms using Form Builder. You can import any Google Doc of ...
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
As I see it, with React hooks we don’t need to render components, unless we want something on the screen. Hooks allows us to reuse stateful logic between “presentational” components. Since Final Form does not have an opinion on visual side of things, it should be possible to use library simply as a collection of hooks.
I think that
useForm
hook was introduced as a way to consume api of the closest form - analogous children as a function inside<Form>
. I propose a new hookuseFinalForm
- that would have api similar to the<Form>
itself.So usage would look something like:
What do you think, @erikras ?
Ah, I’ve just figured you are using react-final-form-hooks in the sandbox: https://github.com/final-form/react-final-form-hooks#whats-the-difference-between-react-final-form-hooks-and-the-hooks-introduced-in-react-final-form-v5, though I did not completely understand why RFF’s useForm couldn’t be like RFF-hooks’.