| 1 | // Example from https://beta.reactjs.org/learn |
| 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 MyApp() { |
| 23 | return <MyButton /> |
| 24 | } |