How to use the react-query.usePaginatedQuery function in react-query

To help you get started, we’ve selected a few react-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github exercism / website / app / javascript / hooks / request-query.js View on Github external
export function usePaginatedRequestQuery(key, request) {
  return usePaginatedQuery(
    [key, request.endpoint, request.query],
    handleFetch,
    camelizeKeys(request.options)
  )
}
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / services / apiService.ts View on Github external
export function useBetterPaginatedQuery<T>(
  key: false | any[],
  fetchFunction: (...params: any) => any,
  config?: any
): PaginatedQueryResult<T> {
  return usePaginatedQuery<T, any, any>(
    key,
    (_, ...params) => {
      return fetchFunction(...params);
    },
    config
  );
}
github exercism / website / app / javascript / hooks / request-query.ts View on Github external
export function usePaginatedRequestQuery<TResult = unknown, TError = unknown>(
  key: QueryKey,
  request: PaginatedRequest,
  isMountedRef: React.MutableRefObject<boolean>
): PaginatedQueryResult<TResult, TError> {
  return usePaginatedQuery<TResult, TError>(
    key,
    () => {
      return handleFetch(request, isMountedRef)
    },
    {
      refetchOnWindowFocus: false,
      staleTime: 1000 * 30,
      ...camelizeKeys(request.options),
    }
  )
}