Web DevelopmentIntermediate 2 to 4 hours

Code-Split a Bloated React App

Reduce the initial JavaScript bundle size by lazily loading non-critical components.

The Scenario

The companys React dashboard takes forever to become interactive (poor Time to Interactive). A bundle analysis reveals that a massive charting library (Chart.js) and a heavy PDF-generation library are being downloaded immediately when the user hits the login screen, even though they are only used deep inside the app.

The Brief

Refactor the provided React routing setup. You need to implement route-level code splitting using `React.lazy` and `Suspense`. Ensure that the Dashboard and Settings routes (which contain the heavy libraries) are separated into their own chunks and only downloaded when the user navigates to them.

Deliverables

  • The refactored `App.jsx` showing the `React.lazy` imports and `Suspense` boundary
  • A fallback UI component (e.g., a skeleton loader) to show while the chunk is downloading
  • An explanation of how this improves the First Input Delay (FID) and Time to Interactive (TTI)

Submission Guidance

Assume a standard React app using React Router. Show exactly where the Suspense boundary goes to ensure a smooth user experience without flashing loading screens excessively.

Submit Your Work

Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.

This appears on your public Badge.

0/20000 charactersMarkdown supported

One per line or comma separated. Up to 5 links.

By submitting, you agree your submission text, name, and evaluation will appear on a public Badge URL.