Created
August 28, 2018 19:13
-
-
Save becca-bailey/8e9cd02a1f3309cec93f1defe2192b0e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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