Skip to content

Instantly share code, notes, and snippets.

@gisderdube
Last active November 13, 2018 16:58
Show Gist options
  • Save gisderdube/6cd68968234e3dceed3f0a96327ae90e to your computer and use it in GitHub Desktop.
Save gisderdube/6cd68968234e3dceed3f0a96327ae90e to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import GlobalError from './GlobalError'
class Application extends Component {
constructor(props) {
super(props)
this.state = {
error: '',
}
this._resetError = this._resetError.bind(this)
this._setError = this._setError.bind(this)
}
render() {
return (
<div className="container">
<GlobalError error={this.state.error} resetError={this._resetError} />
<h1>Handling Errors</h1>
</div>
)
}
_resetError() {
this.setState({ error: '' })
}
_setError(newError) {
this.setState({ error: newError })
}
}
export default Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment