index.js 769 字节
Newer Older
A
Arunoda Susiripala 已提交
1 2 3 4 5
import Link from 'next/link'
import { Component } from 'react'

let counter = 0

6 7 8 9
const linkStyle = {
  marginRight: 10
}

A
Arunoda Susiripala 已提交
10 11 12 13 14 15 16 17 18
export default class extends Component {
  increase () {
    counter++
    this.forceUpdate()
  }

  render () {
    return (
      <div className='nav-home'>
19 20
        <Link href='/nav/about'><a id='about-link' style={linkStyle}>About</a></Link>
        <Link href='/empty-get-initial-props'><a id='empty-props' style={linkStyle}>Empty Props</a></Link>
21
        <Link href='/nav/self-reload'><a id='self-reload-link'>Self Reload</a></Link>
A
Arunoda Susiripala 已提交
22 23 24 25 26 27 28 29 30
        <p>This is the home.</p>
        <div id='counter'>
          Counter: {counter}
        </div>
        <button id='increase' onClick={() => this.increase()}>Increase</button>
      </div>
    )
  }
}