Skip to content

Integration

ReachBell for React

A typed provider, a useReachBell hook, and prebuilt widgets for prompts, banners, toasts, and the notification center. Add three lines, ship the same afternoon.

@reachbell/react on npmbundle sizemonthly downloads

Install

One package, zero peer deps beyond React 18+.

npm install @reachbell/react
# or
yarn add @reachbell/react
# or
pnpm add @reachbell/react

Quick start

Wrap your tree with ReachBellProvider, then read the live state from useReachBell().

// src/main.tsx
import { ReachBellProvider } from '@reachbell/react';
import App from './App';

export default function Root() {
  return (
    <ReachBellProvider
      projectId={import.meta.env.VITE_REACHBELL_PROJECT_ID}
      promptDelay={8000}
      utm={{ source: 'app', medium: 'webpush' }}
    >
      <App />
    </ReachBellProvider>
  );
}

// src/components/SubscribeBell.tsx
import { useReachBell } from '@reachbell/react';

export function SubscribeBell() {
  const { status, subscribe, identify, track } = useReachBell();

  if (status === 'subscribed') return <span>You're in. We'll ping you.</span>;
  return (
    <button
      onClick={async () => {
        await subscribe();
        identify({ email: 'jane@acme.com', plan: 'pro' });
        track('clicked_bell', { placement: 'header' });
      }}
    >
      Enable updates
    </button>
  );
}

What you get

One package wires up segments, A/B tests, automations, and the full analytics stack — no separate SDKs to install per feature.

Typed provider, typed hook

The full SDK surface ships as TypeScript declarations — no any, no untyped event names. Auto-complete in your editor for every track() and identify() call.

Prebuilt widgets, headless escape hatch

Use <PromptModal>, <SubscribeBanner>, <NotificationCenter>, and <ToastHost> off the shelf — or build your own with useReachBell() and the imperative API.

Server-safe by default

The provider renders nothing on the server and hydrates the client lazily after first paint, so SSR frameworks (Remix, RedwoodJS) and Vite SSR builds stay green.

Segments, A/B tests, automations — out of the box

Every identify() and track() call feeds the segment engine, A/B variants, and automations engine in the ReachBell dashboard. No second integration needed.

Analytics + UTM tagger

Outbound clicks get UTM params appended automatically via attachUtmTagger() (added in SDK v1.0.5) so push, email, and in-app campaigns all report cleanly in GA4.

Tiny runtime

6.4 KB gzipped for the headless core; widgets are tree-shaken so you only ship what you use. Zero peer dependencies beyond React 18+.

Looking for the full API reference?

Every hook, prop, callback, and widget is documented with TypeScript examples at docs.reachbell.com/integrations/react.

FAQ

Questions, answered.

Everything teams usually ask before switching. Something missing? Email us — a human replies.

Does it work with Vite, Create React App, Remix, or RedwoodJS?

Yes. The SDK ships ESM + CJS bundles and works with every bundler in common use. Server-rendered frameworks load it lazily client-side — there is nothing to configure for SSR.

Can I use it with React Native?

For React Native we recommend @reachbell/expo (FCM + APNs) — it shares the same useReachBell hook signature, so component code ports directly. The web package targets browsers only.

How do I test the prompt without re-subscribing my browser?

Pass debug={true} to <ReachBellProvider> — the prompt renders even after dismissal, the subscribe() promise no-ops, and every call is logged to the console.

What React versions are supported?

React 18 and 19. The provider uses useSyncExternalStore so it stays compatible with concurrent mode and React Server Components hydration boundaries.

Ship the prompt today.

Free for your first 1,000 subscribers. No credit card.

Ready to make some noise?

Free forever for your first 1,000 subscribers. Set up in five minutes — no credit card needed.

Start free today