Skip to main content

@notifizz/react SDK reference

@notifizz/react ships the React components and hooks for the Notifizz Notification Center widget — a NotifizzInbox component for the default bell, a NotifizzProvider for app-wide state access, and a useNotifizz hook for reading state and driving the widget from any descendant.

TL;DR

  • <NotifizzInbox options={...} /> — drop-in component that renders the bell + dropdown and authenticates the widget.
  • <NotifizzProvider options={...}> + useNotifizz() — share notification state across the app via context, or build a fully headless UI.
  • Three auth modes via authType: 'firebase', 'backendToken', 'none' (dev-only).
  • renderBell prop replaces the default bell with your own UI; useNotifizz exposes unreadCount, isOpen, isReady, open, close, toggle.

Installation

Components

NotifizzInbox

Default component. Mounts the widget, renders the bell, and listens for notifizz:ready / notifizz:state window events.

Props

NotifizzInboxOptions

authType: "none" example (dev only)

authType: "none" ships unauthenticated widget access — anyone with the apiKey can read any user’s inbox. Use it for local development only. Production must use firebase or backendToken.

NotifizzProvider

Wraps a subtree to provide notification state via React context. Use it when multiple components need access to notification state, or when you want a fully headless UI.

Hooks

useNotifizz()

Read notification state and drive the widget from any component inside a NotifizzProvider.

Return value: NotifizzBellContext

useNotifizz() must be called from inside a NotifizzProvider. Calling it outside throws.

Custom bell

Replace the default bell with your own component using the renderBell prop:
The ctx object is the same NotifizzBellContext that useNotifizz() returns.

Headless mode

Headless mode gives you full control over the notification UI while Notifizz handles real-time data and state. Pair it with your design system for a fully bespoke notification surface.
Use NotifizzProvider + useNotifizz without rendering NotifizzInbox:

State shape

NotifizzState (read via onStateChange or useNotifizz):

Exported types

FAQ

The component calling useNotifizz() is rendered outside the <NotifizzProvider> tree. Move the provider higher up — typically wrapping your whole app at the root layout. If you only need state in one place, you can use <NotifizzInbox onStateChange={...}> directly without a provider.
useNotifizz returns React state internally — re-renders are automatic. If your component is memoised (e.g. React.memo) and re-rendering only on prop changes, ensure you destructure the values you need from useNotifizz() directly inside the component body, not via a stale closure.
Yes — that’s the common pattern. The provider exposes state to descendant components, the inbox renders the bell. Mount the inbox inside the provider tree once.
React 18+ StrictMode intentionally runs effects twice in dev. The widget guards against duplicate mounts via cancelled flags and a readyFired ref — you should not see two bells, but you may see two ready callbacks fire briefly. Production builds run effects once.
This is almost always two copies of React loaded in your app, not a bug in the SDK. @notifizz/react declares react and react-dom as peer dependencies and uses yours — but a monorepo, a locally-linked package that ships its own React, a mismatched transitive version, or a misconfigured bundler can pull in a second one. React’s hook dispatcher then comes back null and any hook (including the SDK’s) crashes.First, confirm there’s really a duplicate — this should print a single version each:
Then force a single instance in your bundler:
If a locally-linked dependency carries its own node_modules/react, deleting that nested copy also resolves it.
Pass new options.userId / options.token — the inbox effect is keyed on options.apiKey and options.authType, so changes to those re-authenticate. For a clean swap (no flash of the previous user’s inbox), conditionally render the provider so it unmounts/remounts when the user changes.
The widget is browser-only — NotifizzInbox and NotifizzProvider no-op when window is undefined. SSR your page normally; the widget hydrates and authenticates on the client. The rendered HTML contains the mount <div> but no widget content until the script loads.

See also

Notification Center overview

Lifecycle, state model, positioning, custom bell.

Authentication overview

Pick the right widget auth mode.

Frontend quickstart

Get the widget rendering in under five minutes.

Backend quickstart

Send the events the widget will display.