Skip to main content

Function: useReviews()

useReviews(preprintUri, params, options): UseQueryResult<{ cursor: string; hasMore: boolean; reviews: object[]; total: number; }, Error>

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

Fetches reviews for a preprint.

Parameters

preprintUri

string

AT-URI of the preprint

params

ReviewListParams = {}

Query parameters (limit, cursor, motivation, inlineOnly)

options

UseReviewsOptions = {}

Hook options

Returns

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

Query result with reviews data

Remarks

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

Example

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

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