Verschachtelte und appübergreifende Navigation verwalten
Lernen Sie, verschachtelte Routen einzelner Micro Frontends zu koordinieren und nahtlos von einem MFE zu einem anderen zu navigieren.
Verschachtelte und appübergreifende Navigation verwalten ist eine kostenlose Micro Frontends Architecture with Module Federation-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Micro Frontends Architecture with Module Federation-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Micro Frontends Architecture with Module Federation-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
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 MFEMounting 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
basenameto 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.
Häufig gestellte Fragen
Ist die Lektion „Verschachtelte und appübergreifende Navigation verwalten“ kostenlos?
Ja — der vollständige Text von „Verschachtelte und appübergreifende Navigation verwalten“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Micro Frontends Architecture with Module Federation-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Micro Frontends Architecture with Module Federation-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Verschachtelte und appübergreifende Navigation verwalten“?
Lernen Sie, verschachtelte Routen einzelner Micro Frontends zu koordinieren und nahtlos von einem MFE zu einem anderen zu navigieren. Du übst Micro Frontends Architecture with Module Federation mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Micro Frontends Architecture with Module Federation zu starten?
Keine Vorkenntnisse erforderlich. Micro Frontends Architecture with Module Federation auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Verschachtelte und appübergreifende Navigation verwalten“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Micro Frontends Architecture with Module Federation-Lektion Code schreiben und ausführen?
Ja. Jede Micro Frontends Architecture with Module Federation-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Zentralisierte Routing-Strategie
- Implementierung des föderierten Routings
- Deep Linking und URL-Verwaltung
- Verschachtelte und appübergreifende Navigation verwalten