Download next.js/test/development/app-dir/source-mapping/app/form.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 334 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/source-mapping/app/form.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/source-mapping/app/form.tsx
-
curl -L -o form.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/source-mapping/app/form.tsx
334 Bytes
| 'use client' | |
| import { useActionState } from 'react' | |
| export function Form({ | |
| action, | |
| id, | |
| }: { | |
| action: () => Promise<string> | |
| id: string | |
| }) { | |
| const [result, formAction] = useActionState(action, 'initial') | |
| return ( | |
| <form id={id} action={formAction}> | |
| <button>Submit</button> | |
| <p>{result}</p> | |
| </form> | |
| ) | |
| } | |