Skip to main content
The useNotifications hook provides a way to fetch and manage notifications in your application. It includes support for pagination, filtering, and real-time updates.

Hook Parameters

Return Value

Notification Type

The Notification type from @novu/react includes many properties. Here are the most commonly used ones:

Example Usage

Here’s how to use the useNotifications hook to fetch and display notifications:

With Filtering

You can filter notifications by various properties:
  • read - Filter notifications by read status
  • seen - Filter notifications by seen status
  • tags - Filter notifications by tags. If multiple tags are provided, Novu evaluates them using OR logic, meaning a notification is included if it contains at least one of the specified tags.
  • data - Filter notifications by data attributes (key-value pairs).
  • severity - Filter notifications by severity
  • limit - Fetch notifications per page
  • createdGte - Fetch notifications created after the given date (in milliseconds)
  • createdLte - Fetch notifications created before the given date (in milliseconds)

With Infinite Scroll

You can implement infinite scroll using the fetchMore function:

Using Notification Actions

The hook provides several actions to manage notifications:

Real-time notifications updates

The notifications list is automatically updated in real-time when new notifications arrive or when notifications state (read, seen, archived, snoozed) changes.