rsnext/test/integration/export/pages/dynamic.js
Tim Neutkens 625288796f
Move next export into it's own directory (#5084)
* Rename static to export in integration tests

* Move export functionality into it’s own directory

* Fix path
2018-09-04 11:21:00 +02:00

33 lines
644 B
JavaScript

/* global location */
import React from 'react'
import Link from 'next/link'
export default class DynamicPage extends React.Component {
static getInitialProps ({ query }) {
return { text: query.text }
}
state = {}
componentDidMount () {
const [, hash] = location.href.split('#')
this.setState({ hash })
}
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>
)
}
}