Skip to content
micro-frontend.dev 2.0

Micro-frontends and JavaScript State Management

Author: Natalia Venditto

Date First Published: Wed Jan 04 2023

State management

A sync’d state is essential to preserve a good user experience across decoupled frontends. You can refer to the pros and cons page, to understand why state is very important.

Event-driven patterns and middleware can help propagate state across decoupled components, even when independently deployed, or deployed hrizontally at scale.

Pub/Sub

A publication and subscription bus is a a good strategy to manage state, and it can be implemented at an infrastructure level, with serverless functions, or client-side, leveraging the browser’s addEventListener API and windows.postMessage(), to communicate events across frontend components.

pubsub