type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & object;Defined in: packages/react-query/src/queryOptions.ts:22
The options accepted by the queryOptions overload selected when initialData is omitted, may be undefined, or is a function that may return undefined — data may be undefined while the query is pending.
TQueryFnData = unknown
The type your queryFn resolves to.
TError = DefaultError
The type of errors your queryFn may throw.
TData = TQueryFnData
The type data ends up as after select runs.
TQueryKey extends QueryKey = QueryKey
The type of your queryKey.
optional initialData?:
| InitialDataFunction<NonUndefinedGuard<TQueryFnData>>
| NonUndefinedGuard<TQueryFnData>;If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet). If set to a function, the function will be called once during the shared/root query initialization, and be expected to synchronously return the initial data. Initial data is considered stale by default unless a staleTime has been set. initialData is persisted to the cache.