https://github.com/exogen/next-modal-pages
For demonstration purposes only.
https://github.com/exogen/next-modal-pages
Last synced: 10 months ago
JSON representation
For demonstration purposes only.
- Host: GitHub
- URL: https://github.com/exogen/next-modal-pages
- Owner: exogen
- Created: 2019-07-20T01:59:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T04:52:54.000Z (about 3 years ago)
- Last Synced: 2025-03-16T14:53:56.704Z (10 months ago)
- Language: JavaScript
- Size: 1.05 MB
- Stars: 21
- Watchers: 1
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Next.js Modal Pages Demo
```
$ yarn
$ yarn start
```
## How Does It Work?
- Page updates in Next.js route transitions are performed by unmounting the
previous page component and mounting the next one.
- In `_app.js`, you have the ability to render additional content besides just
the current page component (in fact you could skip rendering the page
component entirely if you wanted).
- So, this demo renders a component in `_app.js` that keeps track of the
previously rendered page components. When the latest page is rendered and
given a `modal` query param, the page is pushed onto a stack instead of
completely replacing the previous one.