Skip to content

Instantly share code, notes, and snippets.

@Kornil
Created December 30, 2018 19:08
Show Gist options
  • Save Kornil/cbec1b9535e8a07e6f7a73d025fa81aa to your computer and use it in GitHub Desktop.
Save Kornil/cbec1b9535e8a07e6f7a73d025fa81aa to your computer and use it in GitHub Desktop.
const Header = () => (
<StyledHeader>
<nav>
<ModalContext.Consumer>
{(modalProps) => (
<Button onClick={modalProps.showModal}>login</Button>
{/*
we pass modalProps so the Modal can use them to render if show is true
and to provide the hideModal method for our close functionality
*/}
<Modal title="hello" modalProps={modalProps}>
<p>helloooo</p>
</Modal>
)}
</ModalContext.Consumer>
</nav>
</StyledHeader>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment