react-query#QueryClient JavaScript Examples

The following examples show how to use react-query#QueryClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: _app.js    From awesome-react-starter with MIT License 6 votes vote down vote up
Root = (props) => {
  const { Component, pageProps } = props;
  const queryClient = new QueryClient();

  return (
    <QueryClientProvider client={queryClient}>
      <Component {...pageProps} />
      <Toaster />
    </QueryClientProvider>
  );
}
Example #2
Source File: _app.js    From flame-coach-web with MIT License 6 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 300000,
      refetchOnWindowFocus: false,
      refetchOnReconnect: true,
      refetchOnMount: "always",
      retry: false
    }
  }
})
Example #3
Source File: test-utils.js    From flame-coach-web with MIT License 6 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      // https://react-query.tanstack.com/guides/testing
      retry: false,
    },
  },
})
Example #4
Source File: DynamicCovInce.jsx    From covince with MIT License 6 votes vote down vote up
DynamicCovInce = props => {
  const queryClient = React.useRef(new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
        refetchOnmount: false,
        refetchOnReconnect: false,
        staleTime: twentyFourHoursInMs * 100
      }
    }
  }))

  return (
    <QueryClientProvider client={queryClient.current}>
      <DynamicUI {...props} />
    </QueryClientProvider>
  )
}
Example #5
Source File: App.js    From sed-frontend with Apache License 2.0 6 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: 3,
      retryDelay: 10 * 1000,
      staleTime: Infinity,
      refetchOnWindowFocus: false,
      refetchOnMount: false,
    },
  },
})
Example #6
Source File: Covince.jsx    From covince with MIT License 6 votes vote down vote up
CovInce = ({
  data_url = './data',
  tiles_url = './tiles/Local_Authority_Districts__December_2019__Boundaries_UK_BUC.json',
  config_url = `${data_url}/config.json`,
  trustedQueryParamOrigins,
  api,
  ...props
}) => {
  const queryClient = useRef(new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
        refetchOnmount: false,
        refetchOnReconnect: false,
        staleTime: twentyFourHoursInMs * 100
      }
    }
  }))

  return (
    <QueryClientProvider client={queryClient.current}>
      <DataProvider
        default_data_url={data_url}
        default_tiles_url={tiles_url}
        default_config_url={config_url}
        trustedOrigins={trustedQueryParamOrigins}
        apiImpl={api}
      >
        <UI {...props} />
      </DataProvider>
    </QueryClientProvider>
  )
}
Example #7
Source File: medusa-context.js    From medusa with MIT License 6 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
      staleTime: Infinity,
      retry: 1,
    },
  },
})
Example #8
Source File: testHelpers.js    From sed-frontend with Apache License 2.0 6 votes vote down vote up
createQueryWrapper = () => {
  const queryClient = new QueryClient({
    defaultOptions: { queries: { retry: false } },
  });
  const wrapper = ({ children }) => (
    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
  );

  return wrapper;
}
Example #9
Source File: App.jsx    From airboardgame with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #10
Source File: queryClient.js    From tako with MIT License 5 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
      staleTime: 10 * 60 * 1000,
    },
  },
})
Example #11
Source File: firebase-provider.js    From rainbow-modules with MIT License 5 votes vote down vote up
client = new QueryClient()
Example #12
Source File: App.js    From 4IZ268-2021-2022-ZS with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #13
Source File: _app.jsx    From pooltogether-community-ui with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #14
Source File: _app.jsx    From pooltogether-governance-ui with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #15
Source File: _app.jsx    From pooltogether-pool-builder-ui with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #16
Source File: _app.js    From v3-ui with MIT License 5 votes vote down vote up
queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      ...DEFAULT_QUERY_OPTIONS
    }
  }
})
Example #17
Source File: App.js    From sdk with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #18
Source File: index.js    From react-query-3 with GNU General Public License v3.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #19
Source File: demo.story.js    From react-table-library with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #20
Source File: _app.js    From idena-web with MIT License 5 votes vote down vote up
queryClient = new QueryClient()
Example #21
Source File: App.js    From tulip-frontend with GNU Affero General Public License v3.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #22
Source File: App.jsx    From sitepoint-books-firebase with MIT License 5 votes vote down vote up
function App() {
  const queryClient = new QueryClient()

  return (
    <>
      <header>
        <Navbar />
      </header>
      <main className="container flex-grow p-4 mx-auto">
        <QueryClientProvider client={queryClient}>
          <Switch>
            <Route exact path="/">
              <Home />
            </Route>
            <Route exact path="/category">
              <ScreenCategoryList />
            </Route>
            <Route path="/category/edit/:id">
              <ScreenCategoryForm />
            </Route>
            <Route path="/category/create">
              <ScreenCategoryForm />
            </Route>
            <Route exact path="/author">
              <ScreenAuthorList />
            </Route>
            <Route path="/author/edit/:id">
              <ScreenAuthorForm />
            </Route>
            <Route path="/author/create">
              <ScreenAuthorForm />
            </Route>
            <Route exact path="/book">
              <ScreenBookList />
            </Route>
            <Route path="/book/edit/:id">
              <ScreenBookForm />
            </Route>
            <Route path="/book/detail/:id">
              <ScreenBookDetail />
            </Route>
            <Route path="/book/create">
              <ScreenBookForm />
            </Route>
            <Route path="/login">
              <ScreenLogin />
            </Route>
            <Route path="/join">
              <ScreenJoin />
            </Route>
            <Route component={NotFound} />
          </Switch>
          <ReactQueryDevtools initialIsOpen={false} />
        </QueryClientProvider>
      </main>
      <Footer />
    </>
  )
}
Example #23
Source File: index.js    From ProjectLockdown with GNU General Public License v3.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #24
Source File: DeleteActivationKeyConfirmationModal.test.js    From sed-frontend with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #25
Source File: CreateActivationKeyModal.test.js    From sed-frontend with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #26
Source File: ActivationKeyForm.test.js    From sed-frontend with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #27
Source File: ActivationKeysTable.test.js    From sed-frontend with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #28
Source File: ActivationKeys.test.js    From sed-frontend with Apache License 2.0 5 votes vote down vote up
queryClient = new QueryClient()
Example #29
Source File: _app.js    From peppermint with GNU Affero General Public License v3.0 5 votes vote down vote up
queryClient = new QueryClient()