Home > @apollo/client-react-streaming
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/experimental-nextjs-app-support](https://github.com/apollographql/apollo-client-nextjs/tree/main/packages/experimental-nextjs-app-support) 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-nextjs/tree/main/integration-test/vite-streaming) as an example.
Class |
Description |
---|---|
A version of For more documentation, please see the Apollo Client API documentation. | |
This link can be used to "debounce" the initial response of a multipart request. Any incremental data received during the After If | |
A version of For more documentation, please see the Apollo Client API documentation. | |
This link will (if called with 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 query myQuery {
fastField
... @defer(label: "SsrDontStrip1") {
slowField1
}
... @defer(label: "SsrDontStrip2") {
slowField2
}
} You can also use the link with | |
A convenient combination of |
Function |
Description |
---|---|
> This export is only available in React Client Components Creates a "manual" Data Transport, to be used with | |
> 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. | |
> 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 afterEach(resetApolloSingletons); | |
> 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 afterEach(resetManualSSRApolloSingletons); | |
> This export is only available in React Client Components Creates an ApolloProvider for streaming SSR. |
Interface |
Description |
---|---|
Preloads data in React Server Components to be hydrated in Client Components. ### Example with <PreloadQuery
query={QUERY}
variables={{
foo: 1
}}
>
{(queryRef) => (
<Suspense fallback={<>loading</>}>
<ClientChild queryRef={queryRef} />
</Suspense>
)}
</PreloadQuery> ### Example for <PreloadQuery
query={QUERY}
variables={{
foo: 1
}}
>
<Suspense fallback={<>loading</>}>
<ClientChild />
</Suspense>
</PreloadQuery> | |
Props for | |
A A child client component reading the | |
> This is only available in React Client Components A version of |
Variable |
Description |
---|---|
> 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 |
Type Alias |
Description |
---|---|
Interface to be implemented by a custom data transport component, for usage with This component needs to provide a | |
Events that will be emitted by a wrapped ApolloClient instance during SSR on |