Skip to content

useEndpointQuery

useEndpointQuery<Req, Res, Selected>(endpoint, request, options?): UseEndpointQueryResult<Res, Selected, Req>

Defined in: wp-typia-rest/src/react-query.ts:43

Query an endpoint contract and keep the validated result in the shared cache.

Req

Res

Selected = Res

ApiEndpoint<Req, Res>

GET endpoint contract to execute.

Req

Query input used to build the cache key and request.

UseEndpointQueryOptions<Req, Res, Selected> = {}

Cache, fetch, and lifecycle options for the query.

UseEndpointQueryResult<Res, Selected, Req>

Query state, cached data, validation details, and a refetch helper.

Use select, enabled, and staleTime to adapt the hook to UI needs without leaking transport or validation details into components.

const query = useEndpointQuery(endpoint, { slug: "hero-card" });