Skip to content

Instantly share code, notes, and snippets.

@Reine0017
Created November 4, 2021 12:43
Show Gist options
  • Select an option

  • Save Reine0017/b0e895dc1d0476920b21143d44e15a42 to your computer and use it in GitHub Desktop.

Select an option

Save Reine0017/b0e895dc1d0476920b21143d44e15a42 to your computer and use it in GitHub Desktop.
Demo with Portal - ReactPortalPage
function ReactPortalPage() {
const [openModal1, setOpenModal1] = useState(false)
return (
<div className="ReactPortalPage">
THIS IS THE REACT PORTAL PAGE (TO DEMO REACT PORTALS W MODALS)
{/* ...commented out for brevity */}
<div className="withPortal">
Demo With Portal
<div className="sectionContent" onClick={() => console.log("clicked withPortal")}>
<button onClick={() => setOpenModal1(true)}>Click Me To Open Modal</button>
<ModalPortal openModal={openModal1} closeModal={() => setOpenModal1(false)}/>
</div>
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment