1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/test/integration/basic/pages/nav/index.js
Arunoda Susiripala 412f9739d8 Reload the page if asked to change the current URL (#1159)
* Add support to reload the page when ask to change the same url.

* Do not run change() in the initial page load.

* Add integration tests.

* Add self-reload.js
2017-02-15 19:27:41 +01:00

32 lines
770 B
JavaScript

import Link from 'next/link'
import { Component } from 'react'
let counter = 0
const linkStyle = {
marginRight: 10
}
export default class extends Component {
increase () {
counter++
this.forceUpdate()
}
render () {
return (
<div className='nav-home'>
<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>
<Link href='/nav/self-reload'><a id='self-reload-link'>Self Reload</a></Link>
<p>This is the home.</p>
<div id='counter'>
Counter: {counter}
</div>
<button id='increase' onClick={() => this.increase()}>Increase</button>
</div>
)
}
}