Skip to main content

useFetchComments

Overview

The useFetchManyComments hook allows you to retrieve a list of comments based on various filters, such as the associated entity, user, or parent comment. It supports sorting, pagination, and optional inclusion of the related entity data.

Usage Example

Parameters & Returns

Parameters

The hook returns a function that accepts an object with the following fields:
string \
undefined`
string \
undefined`
string \
undefined`
CommentsSortByOptions
The sorting criteria for comments (e.g., top, new). Defaults to ‘new’.
number
required
The page number for pagination.
number \
No
boolean \
No

Returns

The function resolves with an array of comments:
Comment[]
A list of comments matching the criteria.