Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free
Since 3.9.0

Preloading

Apollo Client preloading API reference


createQueryPreloader
Since 3.9.0

A higher order function that returns a preloadQuery function which can be used to begin loading a with the given client. This is useful when you want to start loading a query as early as possible outside of a React component.

Example

const preloadQuery = createQueryPreloader(client);

Signature

function createQueryPreloader(
client: ApolloClient<any>
): PreloadQueryFunction

(src/react/query-preloader/createQueryPreloader.ts)

Parameters

Name / Type
Description

client

ApolloClient<any>

The ApolloClient instance that will be used to load queries from the returned preloadQuery function.

Result

The `preloadQuery` function.
PreloadQueryFunction
Show/hide child attributes
Previous
Hooks
Next
Testing
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc., d/b/a Apollo GraphQL.

Privacy Policy

Company