2018-06-28 20:07:41 +02:00
|
|
|
import React from 'react'
|
|
|
|
|
2019-05-09 04:51:23 +02:00
|
|
|
if (typeof window !== 'undefined' && !(window as any).HMR_RANDOM_NUMBER) {
|
2019-05-30 03:19:32 +02:00
|
|
|
;(window as any).HMR_RANDOM_NUMBER = Math.random()
|
2018-06-28 20:07:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default class Counter extends React.Component {
|
|
|
|
state = { count: 0 }
|
|
|
|
|
2019-05-09 04:51:23 +02:00
|
|
|
incr() {
|
2018-06-28 20:07:41 +02:00
|
|
|
const { count } = this.state
|
|
|
|
this.setState({ count: count + 1 })
|
|
|
|
}
|
|
|
|
|
2019-05-09 04:51:23 +02:00
|
|
|
render() {
|
2018-06-28 20:07:41 +02:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<p>COUNT: {this.state.count}</p>
|
|
|
|
<button onClick={() => this.incr()}>Increment</button>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|