# react-relay

> A framework for building GraphQL-driven React applications.

Latest version **21.0.1** (published 2026-05-27) · MIT license · 336.8K weekly downloads

## Install

```sh
npm install react-relay
pnpm add react-relay
yarn add react-relay
bun add react-relay
```

## Health

**Score 80/100 (A)** — status: active.

Positive: moderate downloads; has types; no vulnerabilities; has provenance; high maintenance score; popular repo.

Warnings: no esm support.

## Facts

| | |
|---|---|
| Version | 21.0.1 |
| Published | 2026-05-27 |
| First published | 2015-03-29 |
| Weekly downloads | 336.8K |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 968.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 18962 |
| Maintainers | fb, yuzhi, josephsavona, relay-bot |
| Keywords | graphql, relay, react |

## Links

- npm: https://www.npmjs.com/package/react-relay
- Repository: https://github.com/facebook/relay
- Homepage: https://relay.dev
- Issues: https://github.com/facebook/relay/issues
- npm.io page: https://npm.io/package/react-relay

## Dependencies (5)

- [fbjs](https://npm.io/package/fbjs.md) ^3.0.2
- [invariant](https://npm.io/package/invariant.md) ^2.2.4
- [nullthrows](https://npm.io/package/nullthrows.md) ^1.1.1
- [relay-runtime](https://npm.io/package/relay-runtime.md) 21.0.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.25.0

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads
- [@urql/exchange-execute](https://npm.io/package/@urql/exchange-execute.md) — 10.9K weekly downloads

## Recent versions

- 21.0.1 (latest) — 2026-05-27
- 0.0.0-main-5c3febad (main) — 2026-09-16
- 13.0.0-rc.2 (dev) — 2021-12-29
- 0.0.0-experimental-4c4107dd (experimental) — 2021-01-22
- 0.0.0-main-f9a7c645 — 2026-09-15
- 0.0.0-main-a4e82e93 — 2026-09-15
- 0.0.0-main-2dcfb056 — 2026-09-15
- 0.0.0-main-94e1e147 — 2026-09-15
- 0.0.0-main-0e8b24f7 — 2026-09-15
- 0.0.0-main-6b79359a — 2026-09-14
- 0.0.0-main-32b87557 — 2026-09-14
- 0.0.0-main-eeea4d56 — 2026-09-14
- 0.0.0-main-f491cfcc — 2026-09-14
- 0.0.0-main-8f3ea97e — 2026-09-14
- 0.0.0-main-820ed71e — 2026-09-13
- … 4301 more at https://npm.io/package/react-relay/versions

## README

## React APIs for Relay

This package contains a collection of React APIs: Hooks and Components that are
integrated with Relay runtime.

Example:

```js
// @flow

import type {UserComponent_user$key} from 'UserComponent_user.graphql';

const React = require('react');

const {graphql, useFragment} = require('react-relay');

type Props = {
  user: UserComponent_user$key,
};

function UserComponent(props: Props) {
  const data = useFragment(
    graphql`
      fragment UserComponent_user on User {
        name
        profile_picture(scale: 2) {
          uri
        }
      }
    `,
    props.user,
  );

  return (
    <>
      <h1>{data.name}</h1>
      <div>
        <img src={data.profile_picture?.uri} />
      </div>
    </>
  );
}
```

For complete API reference, visit https://relay.dev/.

---
_Source: https://npm.io/package/react-relay · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
