rsnext/test/integration/page-extensions/pages/hmr/some-page.tsx
Tim Neutkens 17e410a1d0
Fix Typescript HMR (#4689)
Fixes #4686

Adds tests for @zeit/next-typescript so that we don't regress on this again.

I've fixed an issue in the `next` CLI too which caused lingering processes when the process gets force killed, which is what we do in the test suite, so it kept running if there was no manual quit.
2018-06-28 20:07:41 +02:00

23 lines
481 B
TypeScript

import React from 'react'
if(typeof window !== 'undefined' && !window['HMR_RANDOM_NUMBER']) {
window['HMR_RANDOM_NUMBER'] = Math.random()
}
export default class Counter extends React.Component {
state = { count: 0 }
incr () {
const { count } = this.state
this.setState({ count: count + 1 })
}
render () {
return (
<div>
<p>COUNT: {this.state.count}</p>
<button onClick={() => this.incr()}>Increment</button>
</div>
)
}
}