Skip to main content
Version: 1.0.4

useNotificationCenter

@spartanfx/react v1.0.4


@spartanfx/react / useNotificationCenter

Function: useNotificationCenter()

useNotificationCenter(options?): INotificationCenterHook

Hook for managing notifications with web storage backing

Can be used in two ways:

  1. With config: Creates a new web storage instance
  2. Without config: Accesses the notification center from context

Parameters

options?

IWebStorageOptions

Returns

INotificationCenterHook

Example

// Create instance (at app root)
const config = useNotificationCenter({ storage: 'local', storageKey: 'my-app' });
<NotificationCenterProvider config={config}>...</NotificationCenterProvider>

// Access from context (in child components)
const { addNotification, items } = useNotificationCenter();