@sdc-monitor/demo
Version:
<div align="center"> <a href="#" target="_blank"> <img src="https://i.loli.net/2021/07/28/EvPwd4NjVH3tBfO.jpg" alt="mito-logo" height="90"> </a> <p>A Lightweight SDK For Monitor Web</p>
32 lines (27 loc) • 775 B
JavaScript
const h = React.createElement
const MitoInstance = MITO.init({
debug: true,
silentConsole: true,
maxBreadcrumbs: 10,
dsn: 'http://localhost:2021/errors/upload'
})
window._MITO_ = MitoInstance
class BuggyCounter extends React.Component {
constructor(props) {
super(props)
this.state = { counter: 0 }
this.handleClick = this.handleClick.bind(this)
}
handleClick() {
this.setState(({ counter }) => ({
counter: counter + 1
}))
}
render() {
if (this.state.counter === 3) {
throw new Error('I crashed!')
}
return h('h1', { onClick: this.handleClick, id: 'numException' }, this.state.counter)
}
}
ReactDOM.render(h(MITO.ErrorBoundary, { children: h(BuggyCounter), MitoInstance }), document.getElementById('root'))