Skip to main content
Version: 1.0.4

useSharePointNotificationCenter

@spartanfx/react v1.0.4


@spartanfx/react / useSharePointNotificationCenter

Function: useSharePointNotificationCenter()

useSharePointNotificationCenter(options?): INotificationCenterHook

Hook for managing notifications with SharePoint list backing

Can be used in two ways:

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

Parameters

options?

ISharePointStoreOptions

Returns

INotificationCenterHook

Example

// Create instance (at app root)
import { getSP } from '@spartanfx/react';

const sp = getSP(this.context);
const config = useSharePointNotificationCenter({
sp: sp,
listTitle: 'Notifications',
schema: { id: 'Id', title: 'Title', ... }
});
<NotificationCenterProvider config={config}>...</NotificationCenterProvider>

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