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

ValueType / variantsPurpose
notificationsNotificationRecord[]Current notifications.
showNotification(value: NotificationInput) => stringShows a notification and returns its id.
hideNotification(id: string) => voidHides a notification by id.

On this page