Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Created December 13, 2017 05:09
Show Gist options
  • Save jeanpaulsio/0867ac6ca59649e777cd503fa21b9620 to your computer and use it in GitHub Desktop.
Save jeanpaulsio/0867ac6ca59649e777cd503fa21b9620 to your computer and use it in GitHub Desktop.
class App extends React.Component {
state = { showError: true }
toggleError = () => {
this.setState((prevState, props) => {
return { showError: !prevState.showError }
})
};
render() {
return (
<DivWithErrorHandling showError={this.state.showError}>
<h1>Your Amazing Content</h1>
<button onClick={this.toggleError}>
Toggle Error
</button>
</DivWithErrorHandling>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment