Search code examples
relayjs

Relay Modern Fragment Container, props not available automatically


The documentation states: https://facebook.github.io/relay/docs/en/fragment-container.html#arguments

A graphql tagged fragment. If the fragment uses the name convention <...>_, the fragment's data will be available to the Component as a prop with the given . If the fragment name doesn't specify a prop name, the data will be available as a data prop.

However the data doesn't seem to be passed in as a .data prop to my react component. I have to manually pass it using props.


Solution

  • The data has been fetched and is in the Relay store. However, the component does not know how to fetch this data unless the parent passes the matching payload to it.

    This is not advised but if you experiment using the mask pragma / directive on your components, it will give you an idea of how the pieces fit together.