Skip to content

Instantly share code, notes, and snippets.

@renanmav
Created September 20, 2019 20:09
Show Gist options
  • Save renanmav/c58bd6215866c978244dd80e28da1ad6 to your computer and use it in GitHub Desktop.
Save renanmav/c58bd6215866c978244dd80e28da1ad6 to your computer and use it in GitHub Desktop.
Setup RelayNetworkLogger with relay-runtime v6
import { Network } from 'relay-runtime'
import createRelayNetworkLogger from 'relay-runtime/lib/network/createRelayNetworkLogger'
import RelayNetworkLoggerTransaction from 'relay-runtime/lib/network/RelayNetworkLoggerTransaction'
import cacheHandler from './cacheHandler'
const RelayNetworkLogger = createRelayNetworkLogger(RelayNetworkLoggerTransaction)
const network = Network.create(
process.env.NODE_ENV === 'development' ? RelayNetworkLogger.wrapFetch(cacheHandler) : cacheHandler
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment