Explore the key concepts and practices behind micro-frontends and shared component architecture, including integration strategies, communication patterns, and design considerations. This quiz helps developers and architects assess their understanding of building scalable, maintainable front-end systems using modular approaches.
Which statement best explains the main advantage of using micro-frontends in a large web application?
Explanation: The core benefit of micro-frontends is enabling different teams to develop, test, and deploy separate UI features independently, enhancing agility and scalability. Combining all code in a single repository can lead to complex dependencies and coordination challenges. Micro-frontends do not primarily target server-side performance, nor do they mandate the use of the same programming language for all teams, allowing more flexibility.
In a shared component architecture, what is a key challenge when multiple teams use a common component library across different micro-frontends?
Explanation: Maintaining backward compatibility is essential so updates to shared components do not break existing micro-frontends using previous versions. Unrelated styling conventions can lead to inconsistency, but the main architectural challenge is versioning and compatibility. Making components exclusive to one area goes against the idea of sharing, and redeveloping components reduces efficiency and code reuse.
What technique helps maintain CSS style isolation between two micro-frontends rendered on the same page?
Explanation: Prefixed or scoped class names help prevent unintended style overrides between micro-frontends. Global inline styles increase the risk of style leakage, and merging stylesheets can introduce conflicts. Solely depending on browser default styles limits customization and does not address isolation concerns.
Which approach provides a decoupled way for two micro-frontends to communicate user actions without creating direct dependencies?
Explanation: A central event bus allows micro-frontends to exchange information using events without direct dependencies, supporting loose coupling. Hard-coded function calls and embedding micro-frontends increase interdependence, while global variables risk naming collisions and unpredictable updates.
When using a shared component library across various micro-frontends, what is a recommended practice for managing updates and releases?
Explanation: Semantic versioning enables clear communication about which updates are compatible and which could introduce breakages, helping teams manage dependencies safely. Simultaneous releases reduce agility and are not always feasible. Freezing updates prevents improvements and bug fixes, while informal documentation cannot replace versioning best practices.