Live demo
Open five example apps on Vercel, three hosts and two remotes, and see islands and remote components work.
Try islands and remote components in a browser before you install anything. Five example apps run on Vercel, deployed from main: three hosts and two remotes.
Pick what to embed
- Islands (
vite-remote): the remote renders React Server Components on its server and sends HTML. The island keeps its own React. - Remote components (
components-remote): the host loads the remote's client components into its own React tree and shares its context.
┌──────────────────────────────────────────────────────────────────┐
│ REMOTE vite-remote (remote name "shop", Vite) │
│ serves islands: ProductPanel, Links, MyOrders │
└──────────┬──────────────────────┬──────────────────────┬─────────┘
│ islands │ islands │ island
▼ ▼ ▼
┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
│ HOST │ │ HOST │ │ HOST │
│ next-app-router │ │ next-pages-router │ │ react-spa │
│ ProductPanel │ │ ProductPanel │ │ ProductPanel │
│ Links, MyOrders │ │ Links, MyOrders │ │ │
│ CartButton │ │ CartButton │ │ CartButton │
└────────────────────┘ └────────────────────┘ └────────────────────┘
▲ ▲ ▲
│ remote │ remote │ remote
│ component │ component │ component
┌──────────┴──────────────────────┴──────────────────────┴─────────┐
│ REMOTE components-remote (remote name "cart", Vite) │
│ exposes a remote component: CartButton │
└──────────────────────────────────────────────────────────────────┘| App | Role | Embeds or serves | Live |
|---|---|---|---|
next-app-router | Host | Next.js App Router | app-router |
next-pages-router | Host | Next.js Pages Router, basePath: '/shop', en and fr | pages-router |
react-spa | Host | Vite SPA, browser only | react-spa |
vite-remote | Remote | Islands ProductPanel, Links, MyOrders (private) | vite-remote |
components-remote | Remote | Remote component ./CartButton | components-remote |
Embedded pieces have a dashed outline. The sign-in is a demo: any name works.
Try the App Router host
Open the App Router host.
Click the island's buttons
vite-remote rendered the product panel on its server. The − and + buttons hydrate in your browser.
Add A1 to cart
This remote component runs on the host's React and shares its cart context, so the header count goes up.
Follow the island links
The More products links navigate without a reload, so the cart count stays.
Open the private island
Open /orders and sign in with any name. The host signs a short-lived token, and vite-remote renders that name's orders.
Turn JavaScript off
Reload. The panel and the cart button remain, because the host rendered both on its server.
Try the other hosts
- Pages Router. Open
/shop/fr. The island links keep the basePath and locale./shop/ordersis the private island. - React SPA. The SPA fetches the island and the component in the browser, It has no server to sign tokens, so no private island.
Look at the remotes
- vite-remote:
/_nf/healthanswersok. - components-remote:
/_nf/components.jsonis the signed descriptor of the current build.
Copy the source
Each app is a folder of examples/. Run all five with pnpm examples:dev.