2017-11-04 14:06:16 +00:00
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
class Index extends React.Component {
|
2018-08-04 17:51:35 +00:00
|
|
|
state = {
|
|
|
|
raiseError: false
|
2017-11-04 14:06:16 +00:00
|
|
|
}
|
|
|
|
|
2018-08-04 17:51:35 +00:00
|
|
|
componentDidUpdate () {
|
|
|
|
if (this.state.raiseError) {
|
|
|
|
throw new Error('Houston, we have a problem')
|
|
|
|
}
|
2017-11-04 14:06:16 +00:00
|
|
|
}
|
|
|
|
|
2018-08-04 17:51:35 +00:00
|
|
|
raiseError = () => this.setState({ raiseError: true })
|
|
|
|
|
2017-11-04 14:06:16 +00:00
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<h2>Index page</h2>
|
2018-08-04 17:51:35 +00:00
|
|
|
<button onClick={this.raiseError}>Click to raise the error</button>
|
2017-11-04 14:06:16 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-04 17:51:35 +00:00
|
|
|
export default Index
|