Building a core SPA shell
Like in client-side composition, we’ll require an app shell to bootstrap and compose the application in the user’s browser. Quite often, this shell is rather small and only focused on getting essentials like the routing mechanism for activating pages or a mechanism to share dependencies in place.
In this section, we’ll look at these two basic concerns that are inherent to most SPA shells. We’ll start with the activation mechanism.
Activating pages
One of the core features of a SPA is routing. As such, a SPA shell should be able to determine what pages are shown based on some conditions. In the sample, we’ve already seen that a route handler could just be based on the standard DOM API circulating around the history
object.
In Figure 10.3, we see the standard pattern that most routing engines will follow. An activator module is globally installed, which can be used to register or unregister micro frontends. On every...