Konstantin Tarkus I followed your example but it didn't work and threw a warning: Failed context…
ltlam
41

It looks like you need to pass a relay object like this: {environment: api.environment, variables: {} } in the context of your React component

https://facebook.github.io/react/docs/context.html

I have the same issue. I made a very raw fix:


class RelayContextProvider extends React.Component {
getChildContext() {
return {
relay: {
environment: api.environment,
variables: {}
}
};
}

render() {
return this.props.children;
}
}
RelayContextProvider.
childContextTypes = {
relay: PropTypes.object.isRequired
};


return {
title: 'title',
component: (
<RelayContextProvider>
<MyComponent data={data}/>
</RelayContextProvider>)
};
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.