useAppNotifications is the primary hook for building a notification feed. It loads notifications, tracks the unread count, handles pagination, and exposes actions for marking notifications as read.
Basic Usage
Parameters
Number of notifications to load per page: a whole number from
1 to 100. Defaults to 10. A larger value is rejected with 400 app-notification/invalid-query, never lowered to 100.Optional map of display text templates for each notification type. See Notification Templates.
Returns
The list of notification records. If
notificationTemplates is provided, each notification is augmented with a title and/or content field derived from the template.The last load failure, or
null. Cleared when the next load starts; loadMore() retries it. Shared by every mounted useAppNotifications: there is one notifications list. A SublayError.Load the next page of notifications and append it, or retry the load that failed (a failed first page is retried as the first page). Does nothing while a page is loading or when there is nothing more. Never rejects: a failure lands in
error.Marks a single notification as read. Applies an optimistic update immediately before the API call.
Marks all of the current user’s notifications as read. Applies an optimistic update immediately.
Reload page 1. The loaded notifications stay until the new first page replaces them. Useful for pull-to-refresh. Never rejects: a failure lands in
error.The hook is backed by Redux. Notifications are shared globally in the Redux store — multiple instances of the hook in different components will share the same state.
Related
- Notification Templates — customize display text per type
- useAppNotifications hook reference

