Skip to main content

Return Parameters

Return ParameterTypeHooksDescription
dataT | nullphantomGetThe fetched data or null if no data has been retrieved yet.
responseR | nullphantomPost, phantomPatch, phantomPut, phantomDeleteThe data returned from the server after a successful mutation.
resR | nullAllThe raw server response, typically including headers, status codes, and body.
erroranyAllError object, including error message, status code, and other details, if the request fails.
loadingbooleanAllIndicates whether the request is currently in progress.
refetch() => voidphantomGetFunction to manually trigger a refetch of the data.
post(data: any) => voidphantomPostFunction to send a POST request with the specified body.
patch(data: any) => voidphantomPatchFunction to send a PATCH request with the specified body.
put(data: any) => voidphantomPutFunction to send a PUT request with the specified body.
deleteRequest(options?: { id?: string; body?: Record<string, any>; }) => voidphantomDeleteFunction to trigger a DELETE request, optionally including an id or a request body.
latestDataR | nullphantomPost, phantomPatch, phantomPut, phantomDeleteThe latest data fetched after a successful mutation, if getLatestData is set.

Additional Notes:

  1. Shared Parameters:
    • response, res, error, and loading are common across all hooks, simplifying state handling.
  2. Unique Parameters:
    • data and refetch are exclusive to phantomGet, as they relate to fetching data.
    • post, patch, put, and deleteRequest are specific to their respective mutation hooks.
  3. latestData: Used for hooks with the getLatestData feature. Ensures consistent reactivity by retrieving updated information after mutations.