Platform docs
Auth, users, webhooks & more
Info:
This is beta documentation for Stream Video React SDK v2. For the latest stable version, see the latest version (v1).

StreamVideo

The <StreamVideo /> provider makes the client and its state available to all child components and initializes internationalization.

Best Practices

  • Create StreamVideoClient once and clean up with disconnectUser() on unmount.
  • Place <StreamVideo> at the app root to make the client available everywhere.
  • Use tokenProvider for automatic token refresh in production.

General usage

import { useEffect, useState } from "react";
import { StreamVideo, StreamVideoClient } from "@stream-io/video-react-sdk";

export const App = () => {
  const [client, setClient] = useState<StreamVideoClient>();
  useEffect(() => {
    const myClient = new StreamVideoClient({ apiKey, user, tokenProvider });
    setClient(myClient);
    return () => {
      myClient.disconnectUser();
      setClient(undefined);
    };
  }, [apiKey, user, tokenProvider]);

  return (
    <StreamVideo client={client}>
      <MyUI />
    </StreamVideo>
  );
};

Props

client

Type
StreamVideoClient

StreamVideoClient instance propagated to the component's children as a part of StreamVideoContext. Children can access it with useStreamVideoClient() hook.

i18nInstance

Type
Streami18n | undefined

The Streami18n instance to use, if undefined is provided, a new instance will be created. For more information, see our Internationalization guide.

language

Type Default
string | undefined en

The language to translate UI labels. For more information, see our Internationalization guide.

translations

Type
Record<string, LooseTranslationDictionary> | undefined

Translation dictionaries keyed by language code. They are registered over the SDK's built-in English copy rather than replacing it, so a partial dictionary is safe: any key you omit renders the English written at its call site. For more information, see our Internationalization guide.

Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Video React v2: <Your Question>