[Home](./index.md) > [@apollo/client-react-streaming](./client-react-streaming.md) ## client-react-streaming package This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the \[@apollo/client-integration-nextjs\](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/nextjs) package as an example. It can also be used to use Apollo Client with a custom streaming SSR setup, e.g. with Vite. See the \[vite streaming integration test\](https://github.com/apollographql/apollo-client-integrations/tree/main/integration-test/vite-streaming) as an example. ## Classes
Class Description
[ApolloClient](./client-react-streaming.apolloclient.md) A version of `ApolloClient` to be used with streaming SSR or in React Server Components. For more documentation, please see [the Apollo Client API documentation](https://www.apollographql.com/docs/react/api/core/ApolloClient).
[DebounceMultipartResponsesLink](./client-react-streaming.debouncemultipartresponseslink.md) This link can be used to "debounce" the initial response of a multipart request. Any incremental data received during the `cutoffDelay` time will be merged into the initial response. After `cutoffDelay`, the link will return the initial response, even if there is still incremental data pending, and close the network connection. If `cutoffDelay` is `0`, the link will immediately return data as soon as it is received, without waiting for incremental data, and immediately close the network connection.
[InMemoryCache](./client-react-streaming.inmemorycache.md) A version of `InMemoryCache` to be used with streaming SSR. For more documentation, please see [the Apollo Client API documentation](https://www.apollographql.com/docs/react/api/cache/InMemoryCache).
[ReadFromReadableStreamLink](./client-react-streaming.readfromreadablestreamlink.md) A link that allows the response to be read from a readable stream, e.g. for hydration of a multipart response from RSC or a server loader in the browser.
[RemoveMultipartDirectivesLink](./client-react-streaming.removemultipartdirectiveslink.md) This link will (if called with `stripDefer: true`) strip all `@defer` fragments from your query. This is used to prevent the server from doing additional work in SSR scenarios where multipart responses cannot be handled anyways. You can exclude certain fragments from this behavior by giving them a label starting with `"SsrDontStrip"`. The "starting with" is important, because labels have to be unique per operation. So if you have multiple directives where you want to override the default stipping behaviour, you can do this by annotating them like ```graphql query myQuery { fastField ... @defer(label: "SsrDontStrip1") { slowField1 } ... @defer(label: "SsrDontStrip2") { slowField2 } } ``` You can also use the link with `stripDefer: false` and mark certain fragments to be stripped by giving them a label starting with `"SsrStrip"`.
[SSRMultipartLink](./client-react-streaming.ssrmultipartlink.md) A convenient combination of `RemoveMultipartDirectivesLink` and `AccumulateMultipartResponsesLink`.
[TeeToReadableStreamLink](./client-react-streaming.teetoreadablestreamlink.md) A link that allows the request to be cloned into a readable stream, e.g. for transport of multipart responses from RSC or a server loader to the browser.
## Functions
Function Description
[buildManualDataTransport(args)](./client-react-streaming.buildmanualdatatransport.md) > This export is only available in React Client Components Creates a "manual" Data Transport, to be used with `WrapApolloProvider`.
[createTransportedQueryPreloader(client, { prepareForReuse, notTransportedOptionOverrides, })](./client-react-streaming.createtransportedquerypreloader.md)
[isTransportedQueryRef(queryRef)](./client-react-streaming.istransportedqueryref.md)
[readFromReadableStream(readableStream, context)](./client-react-streaming.readfromreadablestream.md) Apply to a context that will be passed to a link chain containing `ReadFromReadableStreamLink`.
[registerApolloClient(makeClient)](./client-react-streaming.registerapolloclient.md) > This export is only available in React Server Components Ensures that you can always access the same instance of ApolloClient during RSC for an ongoing request, while always returning a new instance for different requests.
[registerLateInitializingQueue(key, callback)](./client-react-streaming.registerlateinitializingqueue.md) Registers a queue that can be filled with data before it has actually been initialized with this function. Before calling this function, `window[key]` can just be handled as an array of data. When calling this funcation, all accumulated data will be passed to the callback. After calling this function, `window[key]` will be an object with a `push` method that will call the callback with the data.
[resetApolloSingletons()](./client-react-streaming.resetapollosingletons.md) > This export is only available in React Client Components Resets the singleton instances created for the Apollo SSR data transport and caches. To be used in testing only, like ```ts afterEach(resetApolloSingletons); ```
[resetManualSSRApolloSingletons()](./client-react-streaming.resetmanualssrapollosingletons.md) > This export is only available in React Client Components Resets the singleton instances created for the Apollo SSR data transport and caches. To be used in testing only, like ```ts afterEach(resetManualSSRApolloSingletons); ```
[reviveTransportedQueryRef(queryRef, client)](./client-react-streaming.revivetransportedqueryref.md)
[skipDataTransport(context)](./client-react-streaming.skipdatatransport.md) Apply to a context to prevent this operation from being transported over the SSR data transport mechanism.
[teeToReadableStream(onLinkHit, context)](./client-react-streaming.teetoreadablestream.md) Apply to a context that will be passed to a link chain containing `TeeToReadableStreamLink`.
[useWrapTransportedQueryRef(queryRef)](./client-react-streaming.usewraptransportedqueryref.md)
[WrapApolloProvider(TransportProvider)](./client-react-streaming.wrapapolloprovider.md) > This export is only available in React Client Components Creates an ApolloProvider for streaming SSR.
## Interfaces
Interface Description
[HydrationContextOptions](./client-react-streaming.hydrationcontextoptions.md)
[PreloadQueryComponent](./client-react-streaming.preloadquerycomponent.md) Preloads data in React Server Components to be hydrated in Client Components. \#\#\# Example with `queryRef` `ClientChild` would call `useReadQuery` with the `queryRef`, the `Suspense` boundary is optional: ```jsx {(queryRef) => ( loading}> )} ``` \#\#\# Example for `useSuspenseQuery` `ClientChild` would call the same query with `useSuspenseQuery`, the `Suspense` boundary is optional: ```jsx loading}> ```
[PreloadTransportedQueryFunction](./client-react-streaming.preloadtransportedqueryfunction.md)
[TransportedQueryRef](./client-react-streaming.transportedqueryref.md) A `TransportedQueryRef` is an opaque object accessible via renderProp within `PreloadQuery`. A child client component reading the `TransportedQueryRef` via useReadQuery will suspend until the promise resolves.
[WrappedApolloProvider](./client-react-streaming.wrappedapolloprovider.md) > This is only available in React Client Components A version of `ApolloProvider` particularly suited for React's streaming SSR.
## Namespaces
Namespace Description
[ApolloClient](./client-react-streaming.apolloclient.md)
## Variables
Variable Description
[DataTransportContext](./client-react-streaming.datatransportcontext.md) > This export is only available in React Client Components If you create a custom data transport, you need to wrap the child tree in a `DataTransportContext.Provider` and provide the `DataTransportAbstraction` to it. See for example https://github.com/apollographql/apollo-client-integrations/blob/37feeaa9aea69b90a974eb9cd0fbd636b62d841a/integration-test/experimental-react/src/WrappedApolloProvider.tsx
## Type Aliases
Type Alias Description
[DataTransportProviderImplementation](./client-react-streaming.datatransportproviderimplementation.md) Interface to be implemented by a custom data transport component, for usage with `WrapApolloProvider`. This component needs to provide a `DataTransportContext` to it's children. See for example https://github.com/apollographql/apollo-client-integrations/blob/37feeaa9aea69b90a974eb9cd0fbd636b62d841a/integration-test/experimental-react/src/WrappedApolloProvider.tsx
[PreloadQueryProps](./client-react-streaming.preloadqueryprops.md)
[PreloadTransportedQueryOptions](./client-react-streaming.preloadtransportedqueryoptions.md)
[QueryEvent](./client-react-streaming.queryevent.md) Events that will be emitted by a wrapped ApolloClient instance during SSR on `DataTransportProviderImplementation.registerDispatchRequestStarted`, to be transported to the browser and replayed there using `DataTransportProviderImplementation.onQueryEvent`.