Introducing Relay Modern
Today, we're releasing Relay Modern, a new version of Relay designed from the ground up to be easier to use, more extensible, and most of all to improve performance on mobile devices.
- Read more about today's release.
- Learn more about Relay Modern.
- See an example using Relay Modern.
New in Relay Modern:
- Support for Persisted Queries.
- Simpler imperative mutation API.
- Client schema extensions.
- Flow type generation.
- Support for GraphQL Subscriptions.
- Experimental support for GraphQL Live Queries via polling.
- Fewer requirements around routing.
- Extensible core which can be used independently of React.
- Garbage Collection for minimal memory use.
- Improved runtime performance and smaller bundle (20% the size of Relay Classic).
Get Started with Relay Modern:
Install the release candidate of react-relay
:
yarn add react-relay
Once updating to v1.0, require('react-relay')
will return the Relay Modern API. For existing Relay apps, update your code to require the existing Relay Classic API: require('react-relay/classic')
.
Relay Compiler and Babel plugin:
In development, Relay Modern relies on a Babel plugin (just as Relay Classic does). Relay Modern also uses a compiler to generate runtime code.
yarn add --dev babel-plugin-relay relay-compiler
Once updating to v1.0, the new babel-plugin-relay
plugin works with both Relay Modern and Relay Classic, replacing the legacy babel-relay-plugin
. It uses much simpler configuration which should feel familiar to your .babelrc files.