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