When to Avoid Apollo Client in React
Apollo Client is a popular and powerful library for managing remote and local data with GraphQL in React applications. However, despite its robust feature set, it is not the ideal tool for every project. This article examines the key scenarios where you should avoid using Apollo Client, highlighting alternative solutions that may better suit your application’s size, architecture, and performance goals.
1. Your Application Does Not Use GraphQL
This is the most straightforward reason to avoid Apollo Client. While
Apollo does have plugins to integrate with REST APIs (such as
apollo-link-rest), doing so introduces unnecessary
complexity. If your backend relies on traditional REST APIs or gRPC, you
should use lightweight data-fetching libraries like TanStack Query
(React Query), SWR, or standard Axios instead.
2. The Project is Small with Simple Data Fetching Needs
Apollo Client comes with a steep learning curve and significant
boilerplate code. If your React app only needs to make a few basic API
calls to display static or infrequently updated data, the overhead of
setting up Apollo Client, writing schemas, and defining queries is not
justified. A simple fetch request combined with React’s
built-in useState and useEffect hooks, or a
lightweight wrapper, is often sufficient.
3. Bundle Size and Performance are Critical Constraints
Apollo Client is a relatively large library, adding roughly 30KB to
40KB (gzipped) to your JavaScript bundle. For performance-sensitive
applications—such as mobile-first web apps, e-commerce sites, or
projects targeting users with slow internet connections—this added
weight can negatively impact initial load times. Using lighter GraphQL
clients like graphql-request or urql can
significantly reduce your bundle size while still allowing you to query
GraphQL APIs.
4. You Only Need Local State Management
While Apollo Client offers mechanisms for managing local state (using reactive variables or local client fields), it is primarily designed as a network-first cache. If your primary goal is to manage client-side state (such as UI themes, modal toggles, or user preferences) without heavy server-side interactions, dedicated state management libraries like Zustand, Redux Toolkit, Jotai, or even React’s native Context API are much simpler and more efficient.
5. You Want to Avoid Complex Cache Management
One of Apollo’s greatest strengths is its normalized cache, but it is
also a common source of bugs and developer frustration. When dealing
with complex mutations, nested data structures, or paginated lists,
manually updating the cache to keep the UI in sync can become incredibly
tedious and error-prone. If your team wants to avoid the complexities of
managing a normalized cache, a document-cache-based library like
urql or a key-value cache like TanStack Query will save you
significant development time.