Download next.js/test/e2e/app-dir/actions/components/Counter.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 377 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/components/Counter.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/actions/components/Counter.tsx
-
curl -L -o Counter.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/actions/components/Counter.tsx
377 Bytes
| 'use client' | |
| import React from 'react' | |
| export function Counter({ onClick }) { | |
| const [count, setCount] = React.useState(0) | |
| return ( | |
| <> | |
| <h1 id="count">{count}</h1> | |
| <button | |
| id="increment" | |
| onClick={async () => { | |
| const newCount = await onClick() | |
| setCount(newCount) | |
| }} | |
| > | |
| +1 | |
| </button> | |
| </> | |
| ) | |
| } | |