Last active
April 7, 2019 02:40
-
-
Save isacjunior/8cc9c7c597891a26296203dd939e80c9 to your computer and use it in GitHub Desktop.
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 } from 'react' | |
interface Props { | |
initialCount: number | |
} | |
function CounterHooks ({ initialCount }: Props) { | |
const [count, setCount] = useState(initialCount) | |
const increment = () => setCount(count + 1) | |
return <button onClick={increment}>{count}</button> | |
} | |
export default CounterHooks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment