mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
412f9739d8
* 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
25 lines
476 B
JavaScript
25 lines
476 B
JavaScript
import { Component } from 'react'
|
|
import Link from 'next/link'
|
|
|
|
let count = 0
|
|
|
|
export default class SelfReload extends Component {
|
|
static getInitialProps ({ res }) {
|
|
if (res) return { count: 0 }
|
|
count += 1
|
|
|
|
return { count }
|
|
}
|
|
|
|
render () {
|
|
return (
|
|
<div id='self-reload-page'>
|
|
<Link href='/nav/self-reload'>
|
|
<a id='self-reload-link'>Self Reload</a>
|
|
</Link>
|
|
<p>COUNT: {this.props.count}</p>
|
|
</div>
|
|
)
|
|
}
|
|
}
|