ReferenceReact
useRecords
Fetch a list of records for an object
Fetch a list of records for an object
Signature
<TValues extends Record<string, unknown> = Record<string, unknown>>(objectName: string, options?: UseRecordsOptions | undefined): UseQueryResult<ListResponse<TypedRecord<TValues>>, Error>Examples
```tsx
// Basic usage
const { data } = useRecords("products");
// With pagination
const { data } = useRecords("products", { limit: 10, offset: 0 });
// With sorting
const { data } = useRecords("products", {
sorts: [{ field: "createdAt", direction: "desc" }]
});
// With type inference from registry
type Product = ExtractRecord<typeof PRODUCT>;
const { data } = useRecords<Product["values"]>("products");