Skip to main content

Function: useReviews()

useReviews(eprintUri, params, options): UseQueryResult<OutputSchema, Error>

Defined in: web/lib/hooks/use-review.ts:175

Fetches reviews for an eprint.

Parameters

eprintUri

string

AT-URI of the eprint

params

ReviewListParams = {}

Query parameters (limit, cursor)

options

UseReviewsOptions = {}

Hook options

Returns

UseQueryResult<OutputSchema, Error>

Query result with reviews data

Remarks

Uses TanStack Query with a 1-minute stale time. Reviews are more dynamic than eprints so they're revalidated more frequently.

Example

const { data, isLoading, error } = useReviews(eprintUri);

if (isLoading) return <ReviewListSkeleton />;
if (error) return <ReviewError error={error} />;

return (
<ReviewList
reviews={data.reviews}
hasMore={data.hasMore}
total={data.total}
/>
);

Throws

When the reviews API request fails