React Integration

YouTube Transcript API for React

Build React components that fetch and display YouTube transcripts. Our API returns clean JSON that maps directly to your component state. Create searchable transcript viewers, video summary tools, or AI-powered chat interfaces with ease.

Install Dependencies

npm create vite@latest my-app -- --template react-ts

Complete Code Example

import { useState } from "react";

interface Segment {
  text: string;
  start: number;
  duration: number;
}

interface TranscriptData {
  title: string;
  channel: string;
  transcript: Segment[];
}

export function TranscriptViewer() {
  const [url, setUrl] = useState("");
  const [data, setData] = useState<TranscriptData | null>(null);
  const [loading, setLoading] = useState(false);

  async function fetchTranscript() {
    setLoading(true);
    try {
      // Call your backend proxy to keep API key secret
      const res = await fetch(
        `/api/transcript?url=${encodeURIComponent(url)}`
      );
      const json = await res.json();
      setData(json);
    } finally {
      setLoading(false);
    }
  }

  return (
    <div>
      <input
        value={url}
        onChange={(e) => setUrl(e.target.value)}
        placeholder="Paste YouTube URL..."
      />
      <button onClick={fetchTranscript} disabled={loading}>
        {loading ? "Loading..." : "Get Transcript"}
      </button>

      {data && (
        <div>
          <h2>{data.title}</h2>
          <p>{data.channel}</p>
          {data.transcript.map((seg, i) => (
            <p key={i}>
              <strong>{seg.start.toFixed(1)}s</strong> {seg.text}
            </p>
          ))}
        </div>
      )}
    </div>
  );
}

Key Features for React Developers

Hooks-based data fetching with useState and useEffect

Compatible with React 18+ and concurrent features

Works with Vite, CRA, and any React setup

Build searchable transcript viewers

Perfect for Chrome extensions with React

Combine with TanStack Query for caching and revalidation

Start Building with React Today

Sign up in 30 seconds. Get 150 free API requests. No credit card required. Your React integration can be live in minutes.