Skip to content

Instantly share code, notes, and snippets.

@Calvein
Created October 25, 2018 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calvein/59ed5a9a56ad9a6461c9775923ad7349 to your computer and use it in GitHub Desktop.
Save Calvein/59ed5a9a56ad9a6461c9775923ad7349 to your computer and use it in GitHub Desktop.
Toggle component usage
let Component = () => {
return (
<>
<Toggle defaultIsOn>
{({ isOn, toggle }) => (
<button onClick={toggle}>
is {isOn ? 'on' : 'off'}
</button>
<Modal isOpen={isOn}>
Hello
</Modal>
)}
</Toggle>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment