Created
April 2, 2020 03:17
-
-
Save jsmanifest/c57129717b6326604e784825f1cf8def 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
function ControlPanel({ children, ...rest }) { | |
const [opened, setOpened] = React.useState(false) | |
const open = () => setOpened(true) | |
const close = () => setOpened(false) | |
return ( | |
<div>{React.cloneElement(children, { opened, open, close, ...rest })}</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment