Created
December 13, 2017 05:09
-
-
Save jeanpaulsio/0867ac6ca59649e777cd503fa21b9620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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