Suspense is a React component that displays fallback content (such as a loading message or spinner) while a component is loading.

It is commonly used with React.lazy() for Lazy Loading.

Example:

import React, { lazy, Suspense } from 'react';

const About = lazy(() => import('./About'));

function App() {
return (


Loading...}>



);
}

export default App;

Advantages of Suspense:

  1. Displays a loading message while waiting.
  2. Improves user experience.
  3. Works with React Lazy Loading.
  4. Helps manage loading states.
  5. Makes code cleaner.

Disadvantages of Suspense:

  1. Requires proper fallback UI.
  2. Lazy-loaded components may take time to appear.
  3. Needs Error Boundaries for handling loading failures.
  4. Can make loading behavior more complex in large applications.