Skip to content

Instantly share code, notes, and snippets.

@becca-bailey
Created August 28, 2018 19:14
Show Gist options
  • Save becca-bailey/6e9bb0ea3d712de9befc8462bf62cdac to your computer and use it in GitHub Desktop.
Save becca-bailey/6e9bb0ea3d712de9befc8462bf62cdac to your computer and use it in GitHub Desktop.
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