Binari
Binari copied to clipboard
Optimized the initial load time with code splitting
Hi, when I visit the web app I felt it's initial load is really slow. So, to increase that speed I have bundled three views separately with react lazy loading. In line 72,
<Suspense fallback={<h1> </h1>}>
<Switch>
<Route path="/playground" component={Playground}/>
<Route path="/about" component={About}/>
<Route path="/" component={LandingPage}/>
</Switch>
</Suspense>
instead of h1 tag we can add any other component like a spinner for the fallback. But I think it's unnecessary because even the content inside Route component lazy loaded other components(Layout) will remain same since it's not wrapped with suspense.
As future steps to increase the speed we can add a service worker and cache all asset files.