2017-06-13 06:14:31 +00:00
|
|
|
/* global location */
|
|
|
|
import React from 'react'
|
2017-05-09 21:03:20 +00:00
|
|
|
import Link from 'next/link'
|
|
|
|
|
2017-06-13 06:14:31 +00:00
|
|
|
export default class DynamicPage extends React.Component {
|
|
|
|
static getInitialProps ({ query }) {
|
|
|
|
return { text: query.text }
|
|
|
|
}
|
|
|
|
|
2018-08-07 03:53:06 +00:00
|
|
|
state = {}
|
|
|
|
|
2017-06-13 06:14:31 +00:00
|
|
|
componentDidMount () {
|
|
|
|
const [, hash] = location.href.split('#')
|
|
|
|
this.setState({ hash })
|
|
|
|
}
|
2017-05-09 21:03:20 +00:00
|
|
|
|
2017-06-13 06:14:31 +00:00
|
|
|
render () {
|
|
|
|
const { text } = this.props
|
|
|
|
const { hash } = this.state
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div id='dynamic-page'>
|
|
|
|
<div>
|
|
|
|
<Link href='/'>
|
|
|
|
<a>Go Back</a>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
<p>{ text }</p>
|
|
|
|
<div id='hash'>Hash: {hash}</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|