0Pricing
Micro Frontends Architecture with Module Federation · Lektion

Status und Hilfsfunktionen über Remotes hinweg teilen

Lernen Sie fortgeschrittene Muster kennen, um nicht nur Bibliotheken, sondern auch zustandsbehaftete Stores, Design-Tokens und Hilfsmodule sicher über föderierte Remotes hinweg zu teilen.

Status und Hilfsfunktionen über Remotes hinweg teilen 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.

Beyond Libraries

Module Federation can share more than third-party libraries. You can expose your own stateful stores, utilities, and design tokens so all remotes use one consistent source.

Sharing a Utility Module

Expose a shared utilities package from one app and consume it everywhere, eliminating copy-pasted helper code.

exposes: { "./format": "./src/utils/format" }
// elsewhere
import { formatPrice } from "shared/format";

Sharing Design Tokens

Expose colors, spacing, and typography as a shared module so every micro frontend stays visually consistent without bundling its own copy of the theme.

exposes: { "./tokens": "./src/theme/tokens" }

Sharing a State Store

A shared store (e.g. a Redux or Zustand instance) lets remotes read and update common data. The key is sharing a single instance, not separate copies.

Why Singleton Matters for State

If two remotes each load their own store, their state diverges. Marking the store package singleton: true guarantees they share the same live instance.

shared: {
  "@app/store": { singleton: true }
}

Exposing the Store Instance

Expose the already-created store, not a factory, so consumers attach to the same object.

import { createStore } from "./store";
export const store = createStore();
// exposes: { "./store": "./src/store-instance" }

Consuming Shared State

Remotes import the shared store and subscribe to it like any local store, but updates from any remote are visible to all.

import { store } from "shell/store";
store.subscribe(() => render(store.getState()));

The Coupling Trade-off

Shared mutable state increases coupling. Overuse recreates the tight dependencies micro frontends try to avoid. Share state only for truly cross-cutting concerns like auth or cart.

Prefer Events for Loose Coupling

Where possible, prefer a shared event channel over a shared mutable store. Events keep remotes decoupled while still letting them react to each other.

Versioning Shared State Contracts

Treat the shape of shared state and utilities as a public contract. Changing it is a breaking change, so version it and communicate updates to consuming teams.

A Layered Sharing Strategy

A healthy strategy layers sharing:

  • Libraries: share freely (React, etc.)
  • Utilities and tokens: share for consistency
  • Mutable state: share sparingly and deliberately

Quick Check

Test your advanced sharing knowledge.

Recap

You learned advanced sharing:

  • Share utilities and design tokens for consistency
  • Share a singleton store for cross-cutting state
  • Expose the instance, not a factory
  • Prefer events to limit coupling
  • Version shared contracts carefully

Thoughtful sharing balances consistency with independence.

Häufig gestellte Fragen

Ist die Lektion „Status und Hilfsfunktionen über Remotes hinweg teilen“ kostenlos?

Ja — der vollständige Text von „Status und Hilfsfunktionen über Remotes hinweg teilen“ 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 „Status und Hilfsfunktionen über Remotes hinweg teilen“?

Lernen Sie fortgeschrittene Muster kennen, um nicht nur Bibliotheken, sondern auch zustandsbehaftete Stores, Design-Tokens und Hilfsmodule sicher über föderierte Remotes hinweg zu teilen. 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 „Status und Hilfsfunktionen über Remotes hinweg teilen“?

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

  1. Gemeinsam genutzte Abhängigkeiten verwenden
  2. Singleton-Module und Versionierung
  3. Dynamisches Laden von Modulen
  4. Status und Hilfsfunktionen über Remotes hinweg teilen
← Zurück zu Micro Frontends Architecture with Module Federation