UseTrackedStateActions
import { UseTrackedStateActions } from "@hyper-fetch/react"
Preview
type UseTrackedStateActions<T> = {
setData: (data: CacheSetState<ExtractResponseType<T> | null>) => void;
setError: (error: CacheSetState<ExtractErrorType<T> | null>) => void;
setExtra: (extra: CacheSetState<ExtractAdapterExtraType<ExtractAdapterType<T>> | null>) => void;
setLoading: (loading: CacheSetState<boolean>) => void;
setRequestTimestamp: (timestamp: CacheSetState<Date>) => void;
setResponseTimestamp: (timestamp: CacheSetState<Date>) => void;
setRetries: (retries: CacheSetState<number>) => void;
setStatus: (status: CacheSetState<ExtractAdapterStatusType<ExtractAdapterType<T>>>) => void;
setSuccess: (success: CacheSetState<boolean>) => void;
}
Structure
| Name | Type | Description |
|---|---|---|
| setData | | Action to set custom data. We can do it locally(inside hook state). If you need to update cache data use client.cache.update(). method. |
| setError | | Action to set custom error. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setExtra | | Action to set custom additional data. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setLoading | | Action to set custom loading. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setRequestTimestamp | | Action to set custom timestamp. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setResponseTimestamp | | Action to set custom timestamp. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setRetries | | Action to set custom retries count. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |
| setStatus | | Action to set custom status. We can do it locally(inside hook state). If you need to turn on loading for all listening hooks use client.requestManager.events.emitLoading() method. |
| setSuccess | | Action to set custom success. We can do it locally(inside hook state). If you need to update cache data use client.cache.update() method. |