The official devtools exchange for use with urql devtools chrome extension.
Requirements
- urql v1.2.0 (or later)
- urql devtools chrome extension
Usage
Install the devtools exchange
# yarn
yarn add -D @urql/devtools
# npm
npm i -D @urql/devtools
Add the devtools exchange to your urql client
// ...
import { defaultExchanges, createClient } from '@urql/core';
import { devtoolsExchange } from '@urql/devtools';
// ...
const client = createClient({
url: 'http://localhost:3001/graphql',
exchanges: [
// replacing devtools with a passthrough exchange for production environments
process.env.NODE_ENV !== 'production'
? devtoolsExchange
: ({ forward }) => forward,
...defaultExchanges,
],
});
Contributing
Have experience working with devtools extensions or want to get involved? Check out our contributing docs to get started.