description Apollo Client (Standalone) Overview
When used outside of a full Remix context (e.g., in a dedicated widget or micro-frontend), Apollo Client manages the entire client-side data lifecycle. It handles fetching, caching, and updating state based on GraphQL operations. It is a powerful, self-contained solution for complex UI components that need to manage their own data state independently of the main page loader.
help Apollo Client (Standalone) FAQ
Can Apollo Client run in a widget without Remix?
Yes. A standalone React widget can create its own ApolloClient instance and supply it through ApolloProvider without relying on Remix loaders or route context.
How does a standalone Apollo Client avoid refetching the same GraphQL data?
Its InMemoryCache normalizes query results by identifiers such as __typename and id, allowing multiple components to reuse stored entities. Correct type policies are important when the API uses unusual keys or paginated fields.
How should a micro-frontend share Apollo's cache with the host application?
It can receive the host's ApolloClient instance as an explicit dependency when both surfaces should share authentication and cached entities. Creating a second client gives the widget isolation, but it also creates a separate cache and may duplicate network requests.
What replaces Remix loader data when Apollo Client is used standalone?
Components typically execute operations with hooks such as useQuery and useMutation, so loading, error, and update states live in the client application. Apollo links can add the GraphQL endpoint, authorization headers, retries, or WebSocket subscriptions.
explore Explore More
Similar to Apollo Client (Standalone)
See all arrow_forwardReviews & Comments
Write a Review
Be the first to review
Share your thoughts with the community and help others make better decisions.