ImportantUnlike the external version, this hook manages notification state locally within the component. It still requires HTTPS and explicit user permission to show system-level alerts.
CautionMost mobile browsers ignore the silent and requireInteraction options due to OS-level power management and notification center constraints.
The useLocalNotifications simplifies the native Browser Notification API by managing the permission state internally and providing a clean functional interface to trigger alerts without managing global stores.
| Name | Type | Description |
|---|---|---|
| isSupported | boolean | Whether the browser environment supports the Notification API. |
| notify | (options: UseNotificationOptions) => void | Function to display a local notification. |
| permission | NotificationPermission | Reactive state of the current notification permission. |
| requestPermission | () => Promise<NotificationPermission> | Method to prompt the user for notification access. |