useNotifications
Reads notifications and exposes show and hide methods.
Reads notifications and exposes show and hide methods.
Call this inside NotificationsProvider or PBCProvider.
Usage
'use client';
import { useNotifications } from '@prosazhin/pbcomponents';
function Example() {
const { showNotification } = useNotifications();
return <button onClick={() => showNotification({ headline: 'Saved' })}>Show</button>;
}Hook API
Returns
| Value | Type / variants | Purpose |
|---|---|---|
notifications | NotificationRecord[] | Current notifications. |
showNotification | (value: NotificationInput) => string | Shows a notification and returns its id. |
hideNotification | (id: string) => void | Hides a notification by id. |