next-federation live demo · cart remote
This is a remote
It has no UI of its own; hosts embed what it serves. This one serves
remote components and is built with Vite
(examples/components-remote): hosts load its client
components at runtime and render them in their own React tree. Its files
are static; each build is signed, so the Next.js hosts can also render
it on their server.
Component it exposes
-
./CartButton: an Add to cart button. It runs on the host's React and updates the host's own cart count, through the sharedexample-cart-contextmodule.
See it in a host
- App Router host (Next.js): server-rendered, then hydrated
- Pages Router host (Next.js): server-rendered, then hydrated
- React SPA host (Vite): rendered in the browser