Allow client component routes to be automatically configured
Once a front-end PubSweet component has been added to an application, the application's routes.js
file needs to be updated to import the appropriate React component from the PubSweet component (usually by requiring the path to the file directly, as the PubSweet component only exports frontend.components
as an array) and then to add a <Route>
element that maps a path to that React component.
In order for adding a component to be a one-click operation, components need to be able to export routes that automatically map paths to React components.
Alternatively, the pubsweet add
command could automatically update the application's routes.js
file, if the app needs to keep control of the path structure.