Skip to content

Instantly share code, notes, and snippets.

@Azayzel
Last active May 15, 2023 11:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Azayzel/6438e3c5b2d16381ced14fe0da78c123 to your computer and use it in GitHub Desktop.
Save Azayzel/6438e3c5b2d16381ced14fe0da78c123 to your computer and use it in GitHub Desktop.
react route data component, lazy
import { lazy, Suspense } from ‘react’;
import { routerType } from "../types/router.types";
const About = lazy(() => import('./About'));
const Home = lazy(() => import('./Home'));
const lazyPagesData: routerType[] = [
{
path: "",
element: <Home />,
title: "home"
},
{
path: "about",
element: <About />,
title: "about"
}
];
export default lazyPagesData;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment