React Apollo screenshot

React Apollo

Author Avatar Theme by Apollographql
Updated: 13 Apr 2023
6835 Stars

:recycle: React integration for Apollo Client

Overview

React Apollo is a deprecated project, with version 4.0.0 marking the final release. Its functionality is now available directly from @apollo/client version 3 and above. This library enables fetching data from GraphQL servers to build reactive UIs using the React framework. It can be used in various contexts such as browsers, React Native, or Node.js for server-side rendering.

Features

  • GraphQL Data Fetching: Retrieve data from GraphQL servers effortlessly.
  • UI Building: Utilize fetched data to build complex and reactive user interfaces.
  • Versatile Usage: Compatible with browsers, React Native, and Node.js environments.

Installation

As React Apollo is deprecated, it is recommended to use @apollo/client directly for Apollo functionality. Here is an example of how you can install @apollo/client to replace React Apollo:

npm install @apollo/client

Then, replace the old imports with new ones as suggested in the deprecation notice:

// Old import from React Apollo
import { useQuery } from '@apollo/react-hooks';

// New import from @apollo/client
import { useQuery } from '@apollo/client';

Summary

React Apollo, now deprecated, was a useful library for fetching data from GraphQL servers and building reactive UIs with the React framework. Users are encouraged to migrate to using @apollo/client for continued support and updates. The library offered versatile usage across different environments, making it a valuable tool for developers working with GraphQL and React.