This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Overview of how this works: | |
// 1. Initialisation data is used to create an instance of LoadedRoot. | |
// 2. LoadedRoot contains a component which is the virtual top-level component. | |
// It uses the initialisation data and can be sure that it won't change (a guarantee you don't have with component props). | |
// It's the only component to have state. | |
// The state can applies to the entire SPA, all routes. | |
// It gets told by the router which page to render. | |
// It can house logic that applies when certain pages change to certain other pages. | |
// 3. LoadedRoot is passed to Routes.routerConfig. | |
// Routes.routerConfig creates a config that sends all routes to the LoadedRoot component, using the Page & RouterCtl as props. |