2019-01-17 22:13:34 +01:00
|
|
|
import Link from 'next/link'
|
2019-10-18 08:00:23 +02:00
|
|
|
import { useCount, useDispatchCount } from '../components/Counter'
|
2018-09-14 12:04:29 +02:00
|
|
|
|
2019-10-18 08:00:23 +02:00
|
|
|
const IndexPage = () => {
|
|
|
|
const count = useCount()
|
|
|
|
const dispatch = useDispatchCount()
|
|
|
|
|
2020-05-18 21:24:37 +02:00
|
|
|
const handleIncrease = (event) =>
|
2019-10-18 08:00:23 +02:00
|
|
|
dispatch({
|
2019-11-11 04:24:53 +01:00
|
|
|
type: 'INCREASE',
|
2019-10-18 08:00:23 +02:00
|
|
|
})
|
2020-05-18 21:24:37 +02:00
|
|
|
const handleDecrease = (event) =>
|
2019-10-18 08:00:23 +02:00
|
|
|
dispatch({
|
2019-11-11 04:24:53 +01:00
|
|
|
type: 'DECREASE',
|
2019-10-18 08:00:23 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<h1>HOME</h1>
|
|
|
|
<p>Counter: {count}</p>
|
|
|
|
<button onClick={handleIncrease}>Increase</button>
|
|
|
|
<button onClick={handleDecrease}>Decrease</button>
|
|
|
|
<p>
|
2019-11-11 04:24:53 +01:00
|
|
|
<Link href="/about">
|
2019-10-18 08:00:23 +02:00
|
|
|
<a>About</a>
|
|
|
|
</Link>
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
)
|
2018-09-14 12:04:29 +02:00
|
|
|
}
|
2019-10-18 08:00:23 +02:00
|
|
|
|
|
|
|
export default IndexPage
|