Read this article to understand the details
const LazyAbout = LazyReact(() => import("./components/About"));
const LazyHome = LazyReact(() => import("./components/Home"));
const App = () => (
<Router>
<Suspense fallback={<div>Loading...</div>}>
<Routes>
<Route path="/" element={<LazyHome />} />
<Route path="/about" element={<LazyAbout />} />
</Routes>
</Suspense>
</Router>
);
you can find an npm module here by @fatso83 https://github.com/fatso83/retry-dynamic-import