Course contentsShow
← React
Lesson 1577 of 2,39639. Server Components in PracticeFree lesson

No Loading States in the Component

Async server components suspend automatically; loading states are handled by Suspense boundaries above them.

No Loading States in the Component

In this lesson: You'll learn why async server components don't need their own loading state management.

The Old Way: Managing Loading

In traditional client components, you're used to this pattern:

function ProductList() {
  const [products, setProducts] = useState([]);
  const [loading, setLoading] = useState(true);
  
  useEffect(() => {
    fetch('/api/products')
      .then(res => res.json())
      .then(data => {
        setProducts(data);
        setLoading(false);
      });
  }, []);
  
  if (loading) return <Spinner />;
  return <div>{/* render products */}</div>;
}

Every component had to track its own loading state. Lots of boilerplate!

Server Components: Automatic Suspension

When a server component is async, it automatically suspends while waiting for data. You don't manage loading states at all:

async function ProductList() {
  const products = await db.products.findMany();
  
  // No loading check needed!
  return (
    <div>
      {products.map(p => <ProductCard key={p.id} {...p} />)}
    </div>
  );
}

Where Loading UI Lives

Loading states are handled by Suspense boundaries above the component in the tree. React bubbles the suspension up to the nearest Suspense, which shows the fallback:

<Suspense fallback={<Spinner />}>
  <ProductList />
</Suspense>

This separation is cleaner: the component focuses on rendering data, while parent boundaries handle loading orchestration.

Key Takeaway: Async server components don't need internal loading states—they suspend automatically, and Suspense boundaries above them provide the loading UI. This eliminates boilerplate and separates data rendering from loading orchestration.