Download react-hook-form/app/src/form.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 383 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/app/src/form.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-hook-form/app/src/form.tsx
-
curl -L -o form.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/app/src/form.tsx
383 Bytes
| import { useForm, Form } from 'react-hook-form'; | |
| import React from 'react'; | |
| export default function FormComponent() { | |
| const methods = useForm<{ | |
| test: string; | |
| }>({ | |
| defaultValues: { | |
| test: '', | |
| }, | |
| }); | |
| return ( | |
| <Form control={methods.control} action={'/test'}> | |
| <input {...methods.register('test')} /> | |
| <button>Submit</button> | |
| </Form> | |
| ); | |
| } | |