2017-01-12 04:14:49 +00:00
|
|
|
import Link from 'next/link'
|
|
|
|
import { Component } from 'react'
|
2017-03-12 03:57:51 +00:00
|
|
|
import Router from 'next/router'
|
2017-01-12 04:14:49 +00:00
|
|
|
|
|
|
|
let counter = 0
|
|
|
|
|
2017-01-20 19:33:46 +00:00
|
|
|
const linkStyle = {
|
|
|
|
marginRight: 10
|
|
|
|
}
|
|
|
|
|
2017-01-12 04:14:49 +00:00
|
|
|
export default class extends Component {
|
|
|
|
increase () {
|
|
|
|
counter++
|
|
|
|
this.forceUpdate()
|
|
|
|
}
|
|
|
|
|
2017-03-12 03:57:51 +00:00
|
|
|
visitQueryStringPage () {
|
|
|
|
const href = { pathname: '/nav/querystring', query: { id: 10 } }
|
|
|
|
const as = { pathname: '/nav/querystring/10', hash: '10' }
|
|
|
|
Router.push(href, as)
|
|
|
|
}
|
|
|
|
|
2017-01-12 04:14:49 +00:00
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<div className='nav-home'>
|
2017-01-20 19:33:46 +00:00
|
|
|
<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>
|
2017-03-06 16:48:35 +00:00
|
|
|
<Link href='/nav/self-reload'><a id='self-reload-link' style={linkStyle}>Self Reload</a></Link>
|
|
|
|
<Link href='/nav/shallow-routing'><a id='shallow-routing-link' style={linkStyle}>Shallow Routing</a></Link>
|
2017-03-31 14:35:45 +00:00
|
|
|
<Link href='/nav/redirect'><a id='redirect-link' style={linkStyle}>Redirect</a></Link>
|
2017-03-12 03:57:51 +00:00
|
|
|
<Link
|
|
|
|
href={{ pathname: '/nav/querystring', query: { id: 10 } }}
|
|
|
|
as={{ pathname: '/nav/querystring/10', hash: '10' }}
|
|
|
|
>
|
|
|
|
<a id='query-string-link' style={linkStyle}>QueryString</a>
|
|
|
|
</Link>
|
2017-03-14 23:06:34 +00:00
|
|
|
<Link href='/nav/about' replace><a id='about-replace-link' style={linkStyle}>Replace state</a></Link>
|
2017-05-03 16:40:09 +00:00
|
|
|
<Link href='/nav/as-path' as='/as/path'><a id='as-path-link' style={linkStyle}>As Path</a></Link>
|
|
|
|
<Link href='/nav/as-path'><a id='as-path-link-no-as' style={linkStyle}>As Path (No as)</a></Link>
|
|
|
|
<Link href='/nav/as-path-using-router'><a id='as-path-using-router-link' style={linkStyle}>As Path (Using Router)</a></Link>
|
2018-05-27 18:47:02 +00:00
|
|
|
<Link href='/nav/on-click'><a id='on-click-link' style={linkStyle}>A element with onClick</a></Link>
|
2018-07-11 22:03:25 +00:00
|
|
|
<Link href='/nav/about'><a id='target-link' target='_blank'>A element with target</a></Link>
|
2017-03-12 03:57:51 +00:00
|
|
|
<button
|
|
|
|
onClick={() => this.visitQueryStringPage()}
|
|
|
|
style={linkStyle}
|
|
|
|
id='query-string-button'
|
|
|
|
>
|
|
|
|
Visit QueryString Page
|
|
|
|
</button>
|
|
|
|
|
2017-01-12 04:14:49 +00:00
|
|
|
<p>This is the home.</p>
|
|
|
|
<div id='counter'>
|
|
|
|
Counter: {counter}
|
|
|
|
</div>
|
|
|
|
<button id='increase' onClick={() => this.increase()}>Increase</button>
|
2018-08-11 20:04:16 +00:00
|
|
|
<Link href='/nav/hash-changes#item-400'><a id='scroll-to-hash'>Scroll to hash</a></Link>
|
2017-01-12 04:14:49 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|