about.js 712 字节
Newer Older
1
import React from 'react'
2
import Link from 'next/link'
3
import { useCount, useDispatchCount } from '../components/Counter'
4

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
const AboutPage = () => {
  const count = useCount()
  const dispatch = useDispatchCount()

  const handleIncrease = event =>
    dispatch({
      type: 'INCREASE'
    })
  const handleIncrease15 = event =>
    dispatch({
      type: 'INCREASE_BY',
      payload: 15
    })

  return (
    <>
      <h1>ABOUT</h1>
      <p>Counter: {count}</p>
      <button onClick={handleIncrease}>Increase</button>
      <button onClick={handleIncrease15}>Increase By 15</button>
      <p>
        <Link href='/'>
          <a>Home</a>
        </Link>
      </p>
    </>
  )
32
}
33 34

export default AboutPage