lore-hook-router
Loads the react-router routes and history type
Loads the react-router routes and history type
Returns the routes used by the application.
The lore.loader
object is a way of lazy-loading files and directories the framework doesn't have control over such as the models, config directory, and in this case the routes.js file at the root of the project.
The reason the loader is used here is because the routes must to be lazy-loaded, since loading the routes will pull in the components, which may be using the lore.connect
decorator that won't exist until the lore.connect
hooks loads.
Trying to load the routes directly in this config file will throw an error during build, because lore loads the config file before any of the hooks, since they need information in the config to determine their behavior.
routes: function(lore) {
return lore.loader.loadRoutes();
}