Click here to access the demo website 🙂
This is just an example of how to use portals to render a modal in React.
You'll see the DOM like this (before rendering the modal):
...and then (after rendering the modal):
(You can see all the dependencies in the package.json file)
-
Clone the project (you'll need a personal access token):
$ git clone https://github.com/victorbadaro/react-modal-portal-example
-
Access its directory:
$ cd react-modal-portal-example
-
Install its dependencies:
$ yarn # feel free to use another package manager, but you might want use yarn once there's already a yarn.lock file in the root directory
-
Start the server by running the
dev
script:$ yarn dev
This project was created and developed with ❤ by Victor Badaró