-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Where are you from?
[X] GSSoc
Description of the Feature
Currently, the React application loads the entire JavaScript bundle for all routes (including Dashboard, Profile, About, and Contact) during the initial page load. This results in a larger-than-necessary bundle size, slowing down the first contentful paint and Time to Interactive (TTI), especially for users on slower networks or mobile devices.
This feature proposes to implement route-based code splitting using React.lazy() and Suspense. This will break the main bundle into smaller chunks that are loaded only when the user navigates to a specific route. This is a React-recommended best practice for performance optimization.
Key Changes:
Convert static imports for route components to dynamic imports using React.lazy.
Wrap lazily-loaded components in a Suspense component to display a fallback UI (e.g., a loading spinner) while the chunk is being fetched.
This change will be seamless to the user but will significantly improve perceived performance.
Estimated time to implement the feature
2-3 Days (This includes testing the lazy loading and creating a simple fallback component)
Benefits:
Reduced initial bundle size.
Faster initial page load time.
Improved performance scores (Lighthouse, PageSpeed Insights).
Better user experience, especially on low-end devices.
Can You assign this to me?