Routes
Routes are pages in your single-page application
Special Cases
Example - Standard Route
// component/Router/Router.component.js
// imported lazily for better performance
export const CartPage = lazy(() => import(/* webpackMode: "lazy", webpackChunkName: "cart" */ 'Route/CartPage'));
// [...]
/** @namespace Component/Router/Component */
export class Router extends PureComponent {
// all standard routes are defined here, including the cart page
[SWITCH_ITEMS_TYPE] = [
{
component: <Route
path={ withStoreRegex('/cart') }
exact
render={ (props) => <CartPage { ...props } /> }
/>,
// position is the "priority" of this route.
// routes with lower position will be rendered first,
// and if several routes match the same URL, the first one is shown
position: 50
},
// [...]
];
// [...]
}
export default Router;Example - URL Rewrite
Last updated