2017-03-12 03:57:51 +00:00
|
|
|
import React from 'react'
|
|
|
|
import Link from 'next/link'
|
2018-05-16 10:35:27 +00:00
|
|
|
import Router, { withRouter } from 'next/router'
|
2017-03-12 03:57:51 +00:00
|
|
|
|
|
|
|
const href = {
|
|
|
|
pathname: '/about',
|
|
|
|
query: { name: 'zeit' }
|
|
|
|
}
|
|
|
|
|
|
|
|
const as = {
|
|
|
|
pathname: '/about/zeit',
|
|
|
|
hash: 'title-1'
|
|
|
|
}
|
|
|
|
|
|
|
|
const handleClick = () => Router.push(href, as)
|
|
|
|
|
2018-05-16 10:35:27 +00:00
|
|
|
export default withRouter(({ router: { query } }) => (
|
2017-03-12 03:57:51 +00:00
|
|
|
<div>
|
2018-05-16 10:35:27 +00:00
|
|
|
<h1>About {query.name}</h1>
|
|
|
|
{query.name === 'zeit' ? (
|
2017-03-12 03:57:51 +00:00
|
|
|
<Link href='/'>
|
|
|
|
<a>Go to home page</a>
|
|
|
|
</Link>
|
|
|
|
) : (
|
|
|
|
<button onClick={handleClick}>Go to /about/zeit</button>
|
|
|
|
)}
|
|
|
|
</div>
|
2018-05-16 10:35:27 +00:00
|
|
|
))
|