Skip to content

Instantly share code, notes, and snippets.

@becca-bailey
Created August 28, 2018 19:13
Show Gist options
  • Save becca-bailey/8e9cd02a1f3309cec93f1defe2192b0e to your computer and use it in GitHub Desktop.
Save becca-bailey/8e9cd02a1f3309cec93f1defe2192b0e to your computer and use it in GitHub Desktop.
class AlertManager extends React.Component {
state = {
alert: undefined
};
render() {
const { alert } = this.state;
const { children } = this.props;
return children({ alert, showAlert: this.showAlert });
}
private showAlert = alert => {
this.setState({
alert
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment