Skip to content

Instantly share code, notes, and snippets.

@yuheiy
Last active August 11, 2023 13:19
Show Gist options
  • Save yuheiy/6e74d175771b19bbfd0c62ee08005cf5 to your computer and use it in GitHub Desktop.
Save yuheiy/6e74d175771b19bbfd0c62ee08005cf5 to your computer and use it in GitHub Desktop.
function App() {
return (
<>
{(() => {
const [isOpen, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>First</Button>
<Popover isOpen={isOpen} onOpenChange={setOpen}>
...
</Popover>
</>
);
})()}
{(() => {
const [isOpen, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Second</Button>
<Popover isOpen={isOpen} onOpenChange={setOpen}>
...
</Popover>
</>
);
})()}
{(() => {
const [isOpen, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Third</Button>
<Popover isOpen={isOpen} onOpenChange={setOpen}>
...
</Popover>
</>
);
})()}
</>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment