I'm using lazy to split my routes and I wanna know if there is any way I can get the loading progress in lazy and suspense.
Currently I'm using it like this.
const Home = lazy(() => import("./Home"));
const About = lazy(() => import("./About"));
function App() {
return (
<Router>
<Switch>
<Suspense fallback={<div>loading</div>}>
<Route path="/" exact={true} component={Home} />
<Route path="/About" component={About} />
</Suspense>
</Switch>
</Router>
);
}
■ But I want to show the loading progress (like youtube).
■ Is there any way I can retrieve the progress for example like below.
<Suspense fallback={({progress}) => <LoadingBar progress={progress}/>}>