This is a HOC for relay modern to work with сomposable react components.
You probably want to use this when you work with smart and dumb components and you need to compose relay data fetching in your smart component and pass it down to dumb component.
Setup
npm install --save relay-compose
Set relay environment using setEnvironment in your enty point. For example in client.js:
import{setEnviroment}from'relay-compose';
importrelayEnvfrom'./createRelayEnvironment'
setEnviroment(relayEnv);
And now you are ready to use it.
Examples
Fragment
import{
graphql,
}from'react-relay';
import{fragment}from'relay-compose';
importPersonsfrom'./Persons';
exportdefaultcompose(
fragment(graphql`
fragment PersonsContainerDesc on Person @relay(plural: true) {