The parameters for the hook.
OptionalapiAdditional options to pass to the API client.
Optionalparams?: Record<string, any>Dynamic query parameters for the API request.
OptionalqueryAdditional options to configure the useQuery
The resource path and any static parameters for the API request.
A hook that helps you fetch a single resource.
The hook uses
useQueryfrom@tanstack/react-queryto fetch data and cache it. It accepts various query options and performs the API request to fetch the resource identified by the givenid. The hook supports additional query parameters and custom API client parameters.If a custom
queryFnis provided, it will be used to perform the query; otherwise, the default API client method will be used. ThequeryKeyis constructed based on the resource path, ID, and other optional parameters to ensure proper caching and refetching.Example