Created
April 19, 2023 06:40
-
-
Save ayoayco/f42a111a5bd9bfcf0ef93770c6cb304a to your computer and use it in GitHub Desktop.
Counter component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
const Counter = () => { | |
const [state, setState] = useState(0) | |
return ( | |
<> | |
<h1>Counter</h1> | |
<p>{state}</p> | |
<button onClick={() => setState(state + 1)}>+</button> | |
<button onClick={() => setState(state - 1)}>-</button> | |
</> | |
) | |
} | |
export default Counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment