| 1 | // Example from https://beta.reactjs.org/learn |
| 2 | |
| 3 | import { useState } from 'react' |
| 4 | import styles from './counters.module.css' |
| 5 | import React from 'react' |
| 6 | |
| 7 | function MyButton() { |
| 8 | const [count, setCount] = useState(0) |
| 9 | |
| 10 | function handleClick() { |
| 11 | setCount(count + 1) |
| 12 | } |
| 13 | |
| 14 | return ( |
| 15 | <div> |
| 16 | <button onClick={handleClick} className={styles.counter}> |
| 17 | Clicked {count} times |
| 18 | </button> |
| 19 | </div> |
| 20 | ) |
| 21 | } |
| 22 | |
| 23 | export default function MyApp() { |
| 24 | return <MyButton /> |
| 25 | } |