Incrementally modernize your Relay Classic app in these steps:
Install the latest version of Relay from the getting started guide.
Start converting your components and mutations to use the Relay Modern APIs from the
'react-relay/compat' module (
commitMutation). It will be easier to go from the leaf components up. The conversion scripts should make this step less tedious.
Once all the components and mutations have been converted to use the Relay Modern APIs, convert to using
QueryRenderer instead of using
Relay.RootContainer. You may supply
'react-relay/classic' as the
environment for most cases.
Once a few or all of your views are using
'react-relay/classic' could be replaced with a
RelayModernEnvironment. Keep in mind that
Store do not share any data. You might want to hold off on this step until views that have significant data overlap can be switched over at the same time. This step is what unlocks the perf wins for your app. Apps using the
RelayModernEnvironment get to send persisted query IDs instead of the full query strings to the server, as well as much more optimized data normalizing and processing.
'react-relay/compat' references in your app to
'react-relay'. This is more of a clean-up step that prevents your app from pulling in unnecessary
© 2013–present Facebook Inc.
Licensed under the BSD License.