rsnext/test/integration/client-navigation/pages/nav/on-click.js
JJ Kasper 7d0919a784 Break up basic test suite (#6730)
* Break out client-navigation and rendering
test from basic test

* Try with parallelism dialed back to 3

* Update jest-junit for more compatible timings in CircleCI

* Bump to test timings

* Use filepath for suitename in jest-junit

* Store reports as artifacts

* Try using classname for timings

* Bump

* Remove reports from artifacts
2019-03-20 11:01:32 +01:00

32 lines
964 B
JavaScript

import { Component } from 'react'
import Link from 'next/link'
export default class OnClick extends Component {
static getInitialProps ({ res, query: { count } }) {
return { count: count ? parseInt(count) : 0 }
}
state = {
stateCounter: 0
}
render () {
const { stateCounter } = this.state
const { count } = this.props
return (
<div id='on-click-page'>
<Link href={`/nav/on-click?count=${count + 1}`} replace>
<a id='on-click-link' onClick={() => this.setState({ stateCounter: stateCounter + 1 })}>Self Reload</a>
</Link>
<Link href='/nav/on-click'>
<a id='on-click-link-prevent-default' onClick={(e) => {
e.preventDefault()
this.setState({ stateCounter: stateCounter + 1 })
}}>Self Reload</a>
</Link>
<p id='query-count'>QUERY COUNT: {count}</p>
<p id='state-count'>STATE COUNT: {stateCounter}</p>
</div>
)
}
}