You can use Fragment Container
Wrap <EmojiList />
Component with createFragmentContainer
HOC then it will grab all of the data you need that you have fetched at the root from QueryRenderer
.
The data will be accessible as props inside the component
// EmojisList.js
import {createFragmentContainer, graphql} from 'react-relay';
class EmojisList extends React.Component {/* code */}
// Export a *new* React component that wraps the original `<EmojisList>`.
export default createFragmentContainer(EmojisList, {
emojisList: graphql`
fragment EmojisList_emojisList on EmojisConnection {
edges {
node {
name
rowId
}
}
}
`,
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…