react-code-dataset / next.js /test /development /app-dir /hook-function-names /app /button /page.tsx
Download next.js/test/development/app-dir/hook-function-names/app/button/page.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 363 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/hook-function-names/app/button/page.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/hook-function-names/app/button/page.tsx
-
curl -L -o page.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/hook-function-names/app/button/page.tsx
363 Bytes
| 'use client' | |
| import { useCallback } from 'react' | |
| const Button = ({ message }: { message: string }) => { | |
| const handleClick = useCallback(() => { | |
| throw new Error(message) | |
| }, [message]) | |
| return ( | |
| <button type="button" onClick={handleClick}> | |
| Click me | |
| </button> | |
| ) | |
| } | |
| export default function Page() { | |
| return <Button message="Kaputt!" /> | |
| } | |