I have this specific need to listen to a custom event in the browser and from there, I have a button that will open a popup window. I\'m currently using React Portal to open
You could also just use react-useportal. It works like:
import usePortal from 'react-useportal'
const App = () => {
const { openPortal, closePortal, isOpen, Portal } = usePortal()
return (
<>
{isOpen && (
This is more advanced Portal. It handles its own state.{' '}
, hit ESC or
click outside of me.
)}
>
)
}