Last active
November 21, 2018 13:34
-
-
Save BrooklinJazz/7a0849623b33e9fbb08c047daf41fc60 to your computer and use it in GitHub Desktop.
React-Hook Counter
This file contains hidden or 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 React, { useState, Fragment } from "react" | |
| export default function Counter(params) { | |
| const [count, setCount] = useState(0); | |
| return ( | |
| <div> | |
| <p>You clicked {count} times</p> | |
| <button onClick={() => setCount(count + 1)}> | |
| Click Me | |
| </button> | |
| </div> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment