Download next.js/test/e2e/app-dir/actions/app/revalidate/client.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 388 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/revalidate/client.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/app/revalidate/client.js
-
curl -L -o client.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/app/revalidate/client.js
388 Bytes
| 'use client' | |
| import { useRouter } from 'next/navigation' | |
| export default function RedirectClientComponent({ action }) { | |
| const router = useRouter() | |
| return ( | |
| <button | |
| id="redirect-revalidate-client" | |
| onClick={async () => { | |
| await action() | |
| router.push('/revalidate?foo=bar') | |
| }} | |
| > | |
| redirect + revalidate (client component) | |
| </button> | |
| ) | |
| } | |