Basics of SPA composition
SPA composition builds on top of client-side composition. However, instead of explicitly mentioning HTML tags, we just load the micro frontends in form of some script files. These scripts will automatically integrate the contained components, mounting and rendering them when certain conditions are fulfilled. In case of fulfilled conditions, we refer to those sub-applications (independent or little SPAs) as being active. The trick is that these independent SPAs will not always be active – and if they are active, they may coexist within one another.
As with all the other patterns, we start our journey into SPA composition with a look at its architecture. Then we follow the essential steps to come up with a sample implementation. Finally, we look at potential enhancements for the derived sample.
The architecture
We’ve already seen how mini applications can be hosted in web components. SPA composition takes this idea a step further. Instead...