queryFulfilled - A Promise that will resolve with a data property (the transformed query result),Īnd a meta property ( meta returned by the baseQuery).requestId - A unique ID generated for the query/mutation.extra - extra as provided as thunk.extraArgument to the configureStore getDefaultMiddleware option.getState - A method to get the current state for the store.dispatch - The dispatch method for the store.throughout the lifecycle of an individual query/mutation call).Ĭan be used in mutations for optimistic updates. The function is called with a lifecycle api object containing properties such as queryFulfilled, allowing code to be run when a query is started, when it succeeds, and when it fails (i.e. Or create and return a string yourself:Ī function that is called when you start each individual query or mutation. Alternately, you can use `defaultSerializeQueryArgs` yourself: Import // omit `client` from the cache key UpdateCachedData, // available for query endpoints only * transformErrorResponse only available with `query`, not `queryFn` */ * transformResponse only available with `query`, not `queryFn` */īaseQueryReturnValue : BaseQueryResult , * either `query` or `queryFn` can be present, but not both simultaneously */īaseQuery : ( arg : Parameters ) => ReturnType extraOptions - The value of the optional extraOptions property provided for a given endpoint.forced - Indicates if a query has been forced.type - Type of request ( query or mutation).extra - Provided as thunk.extraArgument to the configureStore getDefaultMiddleware option.getState - A function that may be called to access the current store state.dispatch - The store.dispatch method for the corresponding Redux store.abort - The abort() method of the AbortController attached to signal.signal - An AbortSignal object that may be used to abort DOM requests and/or read whether the request is aborted.api - The BaseQueryApi object contains:. ![]() args - The return value of the query function for a given endpoint.See Customizing Queries if fetchBaseQuery does not handle your requirements. RTK Query exports a utility called fetchBaseQuery as a lightweight wrapper around fetch for common use-cases. The base query used by each endpoint if no queryFn option is specified.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |