rsnext/examples/with-route-as-modal
Joseph 0cd20e0ea5
chore: Bump react-modal to 3.16.2 in with-router-as-modal example (#65841)
### What?

Example update to `with-route-as-modal`, which used `react-modal@13.1.2`

### Why?

The `react-modal` version specified, did not include react 18 as
peer-dependency.

This causes users to have problems when creating the example:
https://github.com/vercel/next.js/discussions/65835

### How?

Bump version to latest available, 13.16.1.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-17 22:56:40 -07:00
..
components chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
pages chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
.gitignore Add .yarn/install-state.gz to .gitignore (#56637) 2023-10-18 16:34:48 +00:00
app-styles.module.css
package.json chore: Bump react-modal to 3.16.2 in with-router-as-modal example (#65841) 2024-05-17 22:56:40 -07:00
README.md update example Deploy button URLs (#48842) 2023-04-26 13:31:44 -04:00

with-route-as-modal

On many popular social media, opening a post will update the URL but won't trigger a navigation and will instead display the content inside a modal. This behavior ensures the user won't lose the current UI context (scroll position). The URL still reflect the post's actual page location and any refresh will bring the user there. This behavior ensures great UX without neglecting SEO.

This example shows how to conditionally display a modal based on a route.

Deploy your own

Deploy the example using Vercel or preview live with StackBlitz

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-route-as-modal with-route-as-modal-app
yarn create next-app --example with-route-as-modal with-route-as-modal-app
pnpm create next-app --example with-route-as-modal with-route-as-modal-app

Deploy it to the cloud with Vercel (Documentation).