relay-mock-network-layer
Provides a network layer for relay modern that returns schema-correct mock data using addMockFunctionsToSchema
from graphql-tools
;
This is useful for working in an environment like storybook where you want to work on your components without hitting a live GraphQL server.
Usage
;;; const network = Network; // Create an environment using this network:const store = ;const environment = network store; // use environment in <QueryRenderer>
Mocking custom scalar types
If your schema has custom scalar types you'll need to use the resolvers
option to ensure those types get mocked correctly. Pass this option an object containing a resolve function for each custom scalar.
...;; ... ;