react-storybooks-relay-container
When writing React Storybook stories that have components that rely on relay, you can very easily run those components against your real API. However, doing it against stubbed data can be tricky.
This module adds a container that will pass through your API responses as though they were the real relay data.
So your stories looks like this:
; ;; ;
It looks like this behind the scenes:
/* @flow */'use strict';;;// Emulates a Relay-compatible container, passing the data in directly.// It's hard to know how well this can work for complicated examples. However,// it's worked well enough so far - ./Component// Provide a stubbed context for child componentes{returnrelay:environment:'@@RelayModernEnvironment': trueunstable_internal:{}thispropsprops{}{}fragment: {}{}{}{}{}{}{}{}data: {}{}{}{}{}{}{}{}{}{}{}{}variables: thispropsvariables || {}route: name: 'string' params: {} useMockData: true queries: {}useFakeData: true;}// Directly render the child, and add the data{return <thispropsComponent ...thispropsprops />;}// Needed to pass the isRelayContainer validation step{}{}{}{}StubbedRelayContainerchildContextTypes =relay: PropTypesobjectroute: PropTypesobjectuseFakeData: PropTypesbool;