Skip to main content

Function: useFields()

useFields(params): UseQueryResult<{ cursor: string; fields: object[]; hasMore: boolean; total: number; }, Error>

Defined in: web/lib/hooks/use-field.ts:138

Fetches a list of fields with optional filtering.

Parameters

params

UseFieldsParams = {}

Query parameters

Returns

UseQueryResult<{ cursor: string; fields: object[]; hasMore: boolean; total: number; }, Error>

Query result with field list

Remarks

Used for browsing the field hierarchy or listing top-level fields.

Example

// Get all top-level approved fields
const { data } = useFields({ status: 'approved' });

// Get children of a specific field
const { data } = useFields({ parentId: 'computer-science' });