Unknown pokemon8/16/2023 As the tag type must correspond to one of the string literals provided to the tagTypes property of the api, the broad string type will not satisfy TypeScript. When spreading the mapped array, by default, TypeScript will broaden the type property to string. This is often written by spreading the result of mapping the received data into an array, as well as an additional item in the array for the 'LIST' ID tag. The type corresponds with QueryArg as supplied to the built endpoint.Ī recommended use-case with providesTags when a query returns a list of items is to provide a tag for each item in the list using the entity ID, as well as a 'LIST' ID tag (see Advanced Invalidation with abstract tag IDs). arg: QueryArg - The argument supplied to the query property when the query itself is called.In the success case for a query, this will be undefined. The type corresponds with Error as supplied to the baseQuery for the api. error: ErrorType | undefined - The error returned by an errored query.In the error case for a query, this will be undefined. The type corresponds with ResultType as supplied to the built endpoint. result: ResultType | undefined - The result returned by a successful query. When using the function notation, both the providesTags and invalidatesTags properties on endpoints are called with the following arguments: RTK Query utilizes a cache tag invalidation system in order to provide automated re-fetching of stale data.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |