Docs
/
In-App UI
React
Hooks
useNotificationStore

useNotificationStore

The useNotificationStore hook provides direct access to the feed store state. This is a lower-level hook that subscribes to state changes from a feed client and returns the current state. It supports optional selectors for optimized re-renders.

Parameters

#
feedClientFeedRequired

A Feed client instance returned from useNotifications.

selector(state: FeedStoreState) => T

Optional selector function to extract a subset of the state. When provided, only re-renders when the selected value changes.

Returns

#

Returns FeedStoreState (or T if a selector is provided) with the following properties:

itemsFeedItem[]

Array of notification feed items.

metadataFeedMetadata

Feed metadata including unread_count, unseen_count, and total_count.

pageInfoPageInfo

Pagination information with before, after, and page_size.

loadingboolean

Whether the feed is currently loading.

networkStatusNetworkStatus

Current network request status.

Example

#

Basic usage

#

The following example demonstrates how to use the useNotificationStore hook to access feed state.

Using with a selector

#

Use a selector to optimize re-renders by only subscribing to specific state changes:

Accessing multiple state properties

#

You can select multiple properties at once: