Await Component

Use Suspense without creating a new component.

Suspense boundaries let you render fallback UI for parts of your page that depend on slow data requests, but they require you to create new component boundaries for those requests.

The <Await> component lets you avoid this friction. It takes in a promise, suspends until that promise fulfills, and then yields the result as a render prop. This lets you render fallback UI for slow data requests without having to create new components yourself.

Clicking a stock in the demo above instantly renders the main content, and uses <Await> to show a fallback spinner for the related stories.


// src/app/stocks/[stockId]/page.tsx
import { Await } from "@/components/await";

export default async function Stock({
}: {
  params: { stockId: string };
}) {
  // Page blocks on this data:
  const stock = await getStock(params.stockId);

  return (

      <Suspense fallback={<Spinner />}>
        {/* ...but renders a spinner for this slower data: */}
        <Await promise={getRecentNews(stock)}>
          {(stories) => (
              { => (
                <li key={}>{story.title}</li>


Here's the code for the <Await> component.

// src/components/await.tsx
export async function Await<T>({
}: {
  promise: Promise<T>;
  children: (result: T) => JSX.Element;
}) {
  let result = await promise;

  return children(result);

Libraries used

Get our latest in your inbox.

Join our newsletter to hear about Sam and Ryan's newest blog posts, code recipes, and videos.