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:null`
The number of comments to fetch per page. Default is
10
.The default sorting criteria for comments (e.g.,
"new"
, "top"
).Whether to include entity details in the fetched comments.
Returns
The hook returns an object with the following fields:The list of user comments fetched so far.
Indicates if comments are currently loading.
Whether there are more comments available to fetch.
Current sorting method for the comments (
"new"
or "top"
).Updates the sort order for comments.
Loads the next page of comments, if available.