Skip to content

Instantly share code, notes, and snippets.

@showlovezz
Last active May 5, 2020 16:39
Show Gist options
  • Save showlovezz/dc5f8c914bca0b93413f97c85abaced5 to your computer and use it in GitHub Desktop.
Save showlovezz/dc5f8c914bca0b93413f97c85abaced5 to your computer and use it in GitHub Desktop.
鼠年全馬鐵人挑戰 - React Hooks useState 1
import React, { useState } from 'react'
const Example = () => {
// useState 採用 0 為初始值
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