useProfileComments
Overview
TheuseProfileComments hook provides a higher-level abstraction for fetching and managing user comments. Unlike the lower-level useFetchComments hook, this hook centralizes the logic for pagination, sorting, and state management, making it easier to implement a complete comments feed for a user profile.
Usage Example
Parameters & Returns
Parameters
The hook accepts an object with the following fields:string \
null`
number
The number of comments to fetch per page. Default is
10.CommentsSortByOptions
The default sorting criteria for comments (e.g.,
"new", "top").boolean
Whether to include entity details in the fetched comments.
Returns
The hook returns an object with the following fields:Comment[]
The list of user comments fetched so far.
boolean
Indicates if comments are currently loading.
boolean
Whether there are more comments available to fetch.
CommentsSortByOptions
Current sorting method for the comments (
"new" or "top").(newSortBy: CommentsSortByOptions) => void
Updates the sort order for comments.
() => void
Loads the next page of comments, if available.

