Created
August 28, 2018 19:14
-
-
Save becca-bailey/6e9bb0ea3d712de9befc8462bf62cdac 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 SimpleComponentWithAlert extends React.Component { | |
render() { | |
const myAlert = { message: "This is my alert", type: "error" }; | |
return ( | |
<AlertManager> | |
{({ alert, showAlert }) => ( | |
<div> | |
{alert && <FancyAlertMessage alert={alert} />} | |
<button onClick={() => showAlert(myAlert)}>Show Alert</button> | |
</div> | |
)} | |
</AlertManager> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment