Apollo client provides a ton of features above and beyond simply fetching data from the server. What follows is a non-exhaustive list:
- Exposed loading, error and data state, so you don't have to create additional stateful components just to fetch data asynchronously
- A normalized caching layer that allows you to avoid making unnecessary repeat requests to your server
- Observable queries that allow your UI to update whenever any query or mutation changes a relevant part of the cache
- Powerful error handling tools through
apollo-link-error
- Pagination support through
loadMore
- Optimistic UI updates for mutations
- Support for Subscriptions through
apollo-link-ws
- Integration with local state management through
apollo-link-state
- Support for deferred queries through the
@defer
directive
- Server-side-rendering support
- Apollo Client Developer Tools chrome extension that includes built-in GraphiQL console, query watcher, mutation inspector and cache inspector.
See the extensive docs here for more details.
There are common patterns that result in having to write (and test) a bunch of boilerplate code, for example maintaining loading state so that your UI knows when a request is complete. Using Apollo, or any other similar client, eliminates the need to write all that boilerplate and provides a clean, well-tested API for you to work with. If you're working on a team, there's also something to be said for using a well-documented library that some of your team may already be familiar with, rather than having to learn some new API that was created just for a particular project.