import { FunctionComponent, LazyExoticComponent, Suspense } from "react"; import { Route, RouteProps } from "react-router-dom"; import { PageLoader } from "../PageLoader"; export interface LazyRouteProps extends RouteProps { component: LazyExoticComponent; } /** * A wrapper around the react-router-dom which takes in a lazy loaded component * and wraps it with and a generic fallback * * Usage: * ```tsx * import { lazy } from "react"; * * const MyComponent = lazy(() => import("./path/to/MyComponent")); * * * * ``` */ export const LazyRoute: FunctionComponent = ({ component: Component, ...routeProps }) => ( }> );