···11import React from 'react';
22-import { createClient, fetchExchange, Provider } from 'urql';
22+import { Client, fetchExchange, Provider } from 'urql';
33import { retryExchange } from '@urql/exchange-retry';
4455import Color from './Color';
6677-const client = createClient({
77+const client = new Client({
88 url: 'https://trygql.formidable.dev/graphql/intermittent-colors',
99 exchanges: [
1010 retryExchange({
1111- maxNumberAttempts: 5,
1111+ maxNumberAttempts: 10,
1212+ maxDelayMs: 500,
1213 retryIf: error => {
1314 // NOTE: With this deemo schema we have a specific random error to look out for:
1415 return (
+2-2
examples/with-retry/src/Color.jsx
···29293030 {result.operation && (
3131 <p>
3232- We retried {result.operation.context.retryCount} times to get a result
3333- without an error.
3232+ To get a result, the retry exchange retried:{' '}
3333+ {result.operation.context.retryCount || 0} times.
3434 </p>
3535 )}
3636 </div>
+2-7
examples/with-retry/src/index.jsx
···11import React from 'react';
22-import { render } from 'react-dom';
22+import { createRoot } from 'react-dom/client';
3344import App from './App';
5566-render(
77- <React.StrictMode>
88- <App />
99- </React.StrictMode>,
1010- document.getElementById('root')
1111-);
66+createRoot(document.getElementById('root')).render(<App />);
+2-2
examples/with-retry/vite.config.js
···11import { defineConfig } from 'vite';
22-import reactRefresh from '@vitejs/plugin-react-refresh';
22+import react from '@vitejs/plugin-react';
3344// https://vitejs.dev/config/
55export default defineConfig({
66- plugins: [reactRefresh()],
66+ plugins: [react()],
77});