Skip to main content

Function: useTerms()

useTerms<T, P>(params, options): useTermsResponse<T>

Defined in: packages/next/src/data/hooks/useTerms.ts:19

The useTerms hook. Returns a collection of term entities

Usage​

const { loading, data } = useTerms({ taxonomy: 'category', slug: 'cat-name' });

Type Parameters​

T​

T extends TermEntity = TermEntity

P​

P extends TaxonomyArchiveParams = TaxonomyArchiveParams

Parameters​

params​

Partial<P> = {}

The parameters accepted by the hook

options​

FetchHookOptions<FetchResponse<T[]>> = {}

Options for the SWR configuration

Returns​

useTermsResponse<T>