cloudflare/vinext
Publicmirrored from https://github.com/cloudflare/vinextAvailable
examples/nextra-docs-template/components/counters.tsx
24lines · modecode
| 1 | "use client"; |
| 2 | |
| 3 | import { useState } from "react"; |
| 4 | import styles from "./counters.module.css"; |
| 5 | |
| 6 | function MyButton() { |
| 7 | const [count, setCount] = useState(0); |
| 8 | |
| 9 | function handleClick() { |
| 10 | setCount(count + 1); |
| 11 | } |
| 12 | |
| 13 | return ( |
| 14 | <div> |
| 15 | <button onClick={handleClick} className={styles.counter}> |
| 16 | Clicked {count} times |
| 17 | </button> |
| 18 | </div> |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | export default function Counters() { |
| 23 | return <MyButton />; |
| 24 | } |
| 25 | |