Skip to content

Lightweight wrapper around RTKQ hook that preserves the ability to provide options #4714

Answered by EskiMojo14
agusterodin asked this question in Q&A
Discussion options

You must be logged in to vote

@agusterodin

import { useRouter } from "next/router";
import {
  fetchBaseQuery,
  SubscriptionOptions,
  TypedUseQueryStateOptions,
  TypedUseQueryStateResult,
} from "@reduxjs/toolkit/query/react";
import { useGetEnrichmentStatusesByQueryUidQuery } from "api/queryResults";

// for example - whatever you're using as base query
type BaseQuery = ReturnType<typeof fetchBaseQuery>;
// whatever you passed like getEnrichmentStatusesByQueryUid: build.query<ResultType, QueryArg>({
type ResultType = { foo: string };
type QueryArg = string

export function useGetEnrichmentStatusesQuery<
  SelectedResult extends Record<string, any> = TypedUseQueryStateResult<
    ResultType,
    QueryArg,
    BaseQ…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@agusterodin
Comment options

@EskiMojo14
Comment options

Answer selected by agusterodin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants