Skip to content

Instantly share code, notes, and snippets.

@isacjunior
Last active April 7, 2019 02:40
Show Gist options
  • Save isacjunior/8cc9c7c597891a26296203dd939e80c9 to your computer and use it in GitHub Desktop.
Save isacjunior/8cc9c7c597891a26296203dd939e80c9 to your computer and use it in GitHub Desktop.
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