0Pricing
Micro Frontends Architecture with Module Federation · Lekcja

Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami

Dowiedz się, jak koordynować zagnieżdżone trasy należące do poszczególnych micro frontendów oraz płynnie przechodzić z jednego MFE do drugiego.

Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami to bezpłatna lekcja Micro Frontends Architecture with Module Federation na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Micro Frontends Architecture with Module Federation, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Micro Frontends Architecture with Module Federation zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

The Nested Routing Challenge

In federated apps, the shell owns top-level routes while each micro frontend owns its own internal (nested) routes. Coordinating the two is the heart of MFE navigation.

Route Ownership

A clear rule helps: the shell maps a route prefix to an MFE, and everything below that prefix belongs to the MFE.

/products/*  -> product MFE
/cart/*      -> cart MFE
/account/*   -> account MFE

Mounting an MFE at a Prefix

The shell renders the MFE for a prefix and lets it handle the remaining path segment.

<Route path="/products/*" element={<ProductApp />} />

Nested Routes Inside an MFE

The MFE defines its own router scoped to its prefix, so it controls its sub-pages without the shell knowing about them.

<Routes>
  <Route path="/" element={<List />} />
  <Route path=":id" element={<Detail />} />
</Routes>

basename for Scoped Routers

Give the MFE router a basename matching its prefix so its links resolve correctly within the larger app.

<BrowserRouter basename="/products">
  ...
</BrowserRouter>

Cross-App Navigation

Sometimes one MFE must send the user into another (e.g. cart linking to checkout). The challenge: it should not import the other MFE router directly.

Navigating via the URL

The cleanest cross-app navigation just changes the URL. The shell router then mounts the right MFE — no direct coupling needed.

history.pushState({}, "", "/checkout");
window.dispatchEvent(new PopStateEvent("popstate"));

A Shared Navigation Service

To avoid manual history hacks, the shell can expose a small navigate function that MFEs call, centralizing navigation logic.

import { navigate } from "shell/navigation";
navigate("/checkout");

Keeping Routers in Sync

All MFEs must respond to the same browser history. Using one history source (the browser History API) keeps the shell and every MFE router synchronized on back/forward.

Avoiding Route Conflicts

Two MFEs claiming overlapping prefixes cause unpredictable rendering. Maintain a single registry of route prefixes to guarantee they never collide.

Lazy Loading per Route

Combine nested routing with lazy loading: only fetch an MFE bundle when the user navigates to its prefix, keeping initial load small.

const ProductApp = React.lazy(() => import("products/App"));

Quick Check

Test your nested-routing knowledge.

Recap

You learned nested and cross-app navigation:

  • Shell owns prefixes; MFEs own nested routes
  • Use basename to scope MFE routers
  • Navigate across apps via URL or a shared service
  • Share one browser history source
  • Prevent prefix conflicts and lazy-load by route

Coordinated routing makes federated navigation feel seamless.

Często zadawane pytania

Czy lekcja „Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami” jest bezpłatna?

Tak — pełny tekst „Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Micro Frontends Architecture with Module Federation, przejdź na CoddyKit PRO. Kurs Micro Frontends Architecture with Module Federation zawiera 4 lekcji w sumie.

Co nauczysz się w „Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami”?

Dowiedz się, jak koordynować zagnieżdżone trasy należące do poszczególnych micro frontendów oraz płynnie przechodzić z jednego MFE do drugiego. Ćwiczysz Micro Frontends Architecture with Module Federation z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Micro Frontends Architecture with Module Federation?

Nie wymagamy żadnego doświadczenia. Micro Frontends Architecture with Module Federation w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.

Ile czasu zajmuje lekcja „Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Micro Frontends Architecture with Module Federation?

Tak. Każda lekcja Micro Frontends Architecture with Module Federation zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Strategia scentralizowanego routingu
  2. Implementacja routingu federacyjnego
  3. Deep linking i zarządzanie adresami URL
  4. Obsługa zagnieżdżonej nawigacji i nawigacji między aplikacjami
← Powrót do Micro Frontends Architecture with Module Federation