Download next.js/test/development/app-dir/use-cache-errors/app/page.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 513 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/use-cache-errors/app/page.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/use-cache-errors/app/page.tsx
-
curl -L -o page.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/use-cache-errors/app/page.tsx
513 Bytes
| 'use client' | |
| import { useActionState } from 'react' | |
| import { useCachedStuff } from './module-with-use-cache' | |
| function OtherClientComponent({ | |
| getCachedStuff, | |
| }: { | |
| getCachedStuff: () => Promise<string> | |
| }) { | |
| const [result, formAction] = useActionState(getCachedStuff, null) | |
| return ( | |
| <form action={formAction}> | |
| <button id="action-button">Submit</button> | |
| <p>{result}</p> | |
| </form> | |
| ) | |
| } | |
| export default function Page() { | |
| return <OtherClientComponent getCachedStuff={useCachedStuff} /> | |
| } | |