Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver ToolsFeatured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver Tools

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Streaming SSR and Suspense Guide

Streaming SSR and Suspense Guide

Master React Suspense patterns and streaming SSR in Google Antigravity Next.js applications for optimal loading experiences.

reactsuspensenextjsstreamingperformance
by antigravity-team
⭐0Stars
.antigravity
# Streaming SSR and Suspense Guide

Leverage React Suspense and streaming server-side rendering in your Google Antigravity applications for superior loading experiences. This guide covers loading states, parallel data fetching, and streaming patterns.

## Suspense with Server Components

Use Suspense to stream content progressively:

```typescript
// app/prompts/page.tsx
import { Suspense } from "react";
import { PromptsList } from "@/components/PromptsList";
import { PromptsListSkeleton } from "@/components/skeletons/PromptsListSkeleton";
import { CategoryFilter } from "@/components/CategoryFilter";
import { CategoryFilterSkeleton } from "@/components/skeletons/CategoryFilterSkeleton";

export default function PromptsPage() {
  return (
    <div className="container py-8">
      <h1 className="text-3xl font-bold mb-8">All Prompts</h1>
      
      <div className="flex gap-8">
        {/* Sidebar loads independently */}
        <aside className="w-64">
          <Suspense fallback={<CategoryFilterSkeleton />}>
            <CategoryFilter />
          </Suspense>
        </aside>
        
        {/* Main content streams separately */}
        <main className="flex-1">
          <Suspense fallback={<PromptsListSkeleton count={12} />}>
            <PromptsList />
          </Suspense>
        </main>
      </div>
    </div>
  );
}
```

## Loading UI Components

Create skeleton components for loading states:

```typescript
// components/skeletons/PromptsListSkeleton.tsx
export function PromptsListSkeleton({ count = 6 }: { count?: number }) {
  return (
    <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
      {Array.from({ length: count }).map((_, i) => (
        <div
          key={i}
          className="rounded-lg border border-gray-200 p-6 animate-pulse"
        >
          <div className="h-6 bg-gray-200 rounded w-3/4 mb-4" />
          <div className="h-4 bg-gray-200 rounded w-full mb-2" />
          <div className="h-4 bg-gray-200 rounded w-5/6 mb-4" />
          <div className="flex gap-2">
            <div className="h-6 bg-gray-200 rounded-full w-16" />
            <div className="h-6 bg-gray-200 rounded-full w-20" />
          </div>
        </div>
      ))}
    </div>
  );
}

// components/skeletons/CategoryFilterSkeleton.tsx
export function CategoryFilterSkeleton() {
  return (
    <div className="space-y-2">
      <div className="h-8 bg-gray-200 rounded w-24 mb-4" />
      {Array.from({ length: 8 }).map((_, i) => (
        <div
          key={i}
          className="h-10 bg-gray-200 rounded animate-pulse"
          style={{ animationDelay: `${i * 100}ms` }}
        />
      ))}
    </div>
  );
}
```

## Parallel Data Fetching

Fetch data in parallel with Suspense:

```typescript
// app/dashboard/page.tsx
import { Suspense } from "react";

// Each component fetches its own data
async function UserStats() {
  const stats = await fetchUserStats(); // Runs in parallel
  return <StatsDisplay stats={stats} />;
}

async function RecentActivity() {
  const activity = await fetchRecentActivity(); // Runs in parallel
  return <ActivityFeed activity={activity} />;
}

async function Notifications() {
  const notifications = await fetchNotifications(); // Runs in parallel
  return <NotificationList notifications={notifications} />;
}

export default function Dashboard() {
  return (
    <div className="grid grid-cols-12 gap-6">
      {/* All three sections load independently and in parallel */}
      <div className="col-span-8">
        <Suspense fallback={<StatsSkeleton />}>
          <UserStats />
        </Suspense>
        
        <Suspense fallback={<ActivitySkeleton />}>
          <RecentActivity />
        </Suspense>
      </div>
      
      <div className="col-span-4">
        <Suspense fallback={<NotificationsSkeleton />}>
          <Notifications />
        </Suspense>
      </div>
    </div>
  );
}
```

## Loading.tsx Conventions

Use Next.js loading conventions:

```typescript
// app/prompts/loading.tsx
export default function Loading() {
  return (
    <div className="container py-8">
      <div className="h-10 bg-gray-200 rounded w-48 mb-8 animate-pulse" />
      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
        {Array.from({ length: 12 }).map((_, i) => (
          <div
            key={i}
            className="h-48 bg-gray-200 rounded-lg animate-pulse"
          />
        ))}
      </div>
    </div>
  );
}
```

## Streaming with use Hook

Stream data with the experimental use hook:

```typescript
// components/StreamedContent.tsx
"use client";

import { use, Suspense } from "react";

function DataDisplay({ dataPromise }: { dataPromise: Promise<Data> }) {
  const data = use(dataPromise);
  return <div>{data.content}</div>;
}

export function StreamedContent() {
  const dataPromise = fetchData(); // Returns promise immediately

  return (
    <Suspense fallback={<div>Loading...</div>}>
      <DataDisplay dataPromise={dataPromise} />
    </Suspense>
  );
}
```

## Best Practices

1. **Strategic Boundaries**: Place Suspense at logical content boundaries
2. **Skeleton Matching**: Make skeletons match actual content dimensions
3. **Progressive Loading**: Stream most important content first
4. **Parallel Fetching**: Let independent data load simultaneously
5. **Error Boundaries**: Combine with error boundaries for resilience
6. **Loading Indicators**: Use subtle animations to indicate activity

When to Use This Prompt

This react prompt is ideal for developers working on:

  • react applications requiring modern best practices and optimal performance
  • Projects that need production-ready react code with proper error handling
  • Teams looking to standardize their react development workflow
  • Developers wanting to learn industry-standard react patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their react implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the react code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this react prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For react projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...