Integrating @urql/exchange-retry’s retryExchange#
Integrating urql is as simple as:
- Install packages
yarn add urql graphql
# or
npm install --save urql graphql
- Add retry exchange
yarn add @urql/exchange-retry
# or
npm install --save @urql/exchange-retry
With Retry#
This example shows urql in use with @urql/exchange-retry's retryExchange
to implement retrying failed operations. This largely follows the "Retrying Operations" docs
page
and uses the trygql.formidable.dev/graphql/intermittent-colors
schema, which emits a special NO_SOUP error randomly.
To run this example install dependencies and run the start script:
yarn install
yarn run start
# or
npm install
npm run start
This example contains:
- The
urqlbindings and a React app with a client set up insrc/App.jsx - The
retryExchangefrom@urql/exchange-retryinsrc/App.jsx - A random colour query in
src/Color.jsx