useCounts
Learn how to use the useCounts hook to fetch notification counts in your React Native application
The useCounts
hook provides a way to fetch various notification counts, including unread, unseen, and total counts. This hook is useful for displaying notification badges and indicators in your application.
Hook Parameters
Parameter | Type | Required | Description |
---|---|---|---|
storeId | string | No | Filter counts by a specific store ID |
query | object | No | Additional query parameters for filtering |
Return Value
Example Usage
Here's how to use the useCounts
hook to fetch and display notification counts:
With Store ID
You can filter counts for a specific store:
With Query Filters
You can also apply additional filters using the query parameter:
The counts are automatically updated in real-time when notifications are marked as read/unread or when new notifications arrive.