Skip to content

useComments

function useComments(activityId): object;

Comments on one activity. Lists the first page on mount and when activityId changes. Does not poll. The page size is the server default (20). hasNext is true when another page exists; loadNext appends it.

add appends an optimistic row, swaps in the server row on success, and on failure — including CONTENT_REJECTED, which stored nothing — removes the row, sets error, and rejects.

Parameter Type
activityId string

object

add: (text) => Promise<void> = thread.add;
Parameter Type
text string

Promise<void>

comments: Comment[] = thread.rows;
enabled: boolean = thread.enabled;
error: Error | null = thread.error;
hasNext: boolean = thread.hasNext;
isLoading: boolean = thread.isLoading;
loadNext: () => Promise<void> = thread.loadNext;

Promise<void>

The network error after the optimistic row has been removed.