useCounts hook provides a way to fetch various notification counts, including unread, unseen, total counts, or filtered by severity. This hook is useful for displaying notification badges and indicators in your application.
Hook parameters
| Property | Type | Description |
|---|---|---|
filters | NotificationFilter[] | Array of filters to apply when fetching counts |
onSuccess | (data: Count[]) => void | Callback function called when counts are successfully fetched |
onError | (error: NovuError) => void | Callback function called when an error occurs |
Return value
Example usage
Here’s how to use theuseCounts hook to fetch and display various notification counts, including unread, unseen, and counts based on severity.