npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nardole/firebase-react

v0.1.0

Published

Elegant React bindings for @nardole/firebase-core. Provide the Firebase App via Context and access it anywhere with hooks. Works great in Micro‑Frontends thanks to the shared singleton under the hood.

Readme

@nardole/firebase-react

Elegant React bindings for @nardole/firebase-core. Provide the Firebase App via Context and access it anywhere with hooks. Works great in Micro‑Frontends thanks to the shared singleton under the hood.

npm version types license: MIT react

  • Why
  • Features
  • Installation
  • Quick Start
  • Usage
    • Provider
    • Hook
  • Micro‑Frontend (MFE)
  • API
  • Compatibility
  • Troubleshooting
  • License

Why

Managing Firebase initialization across multiple React apps or MFEs is error‑prone. This package provides a tiny Provider and Hook built on a shared singleton, ensuring exactly one Firebase instance.

Features

  • FirebaseAppProvider to initialize and provide the app via React Context
  • useFirebaseApp hook to access the current FirebaseApp instance
  • Designed for MFEs — initialize once (even outside React) and reuse everywhere

Installation

  • pnpm add @nardole/firebase-react @nardole/firebase-core firebase react react-dom
  • npm install @nardole/firebase-react @nardole/firebase-core firebase react react-dom
  • yarn add @nardole/firebase-react @nardole/firebase-core firebase react react-dom

Quick Start

  1. Wrap your application with the Provider using your Firebase options.
  2. Use the Hook in child components to access the shared instance.

Usage — Provider

import { FirebaseAppProvider } from '@nardole/firebase-react';

export function AppRoot() {
  return (
    <FirebaseAppProvider
      options={{
        apiKey: 'YOUR_API_KEY',
        authDomain: 'YOUR_AUTH_DOMAIN',
        projectId: 'YOUR_PROJECT_ID',
        appId: 'YOUR_APP_ID',
      }}
    >
      <YourApp />
    </FirebaseAppProvider>
  );
}

Usage — Hook

import { useFirebaseApp } from '@nardole/firebase-react';

export function AnyComponent() {
  const app = useFirebaseApp();
  // Use app with other firebase packages (auth, firestore, etc.)
  return null;
}

Micro‑Frontend (MFE)

Initialize the core service in the shell or any federated module, and React MFEs will reuse it.

// shell or any non-React mfe
import { firebaseService } from '@nardole/firebase-core';
firebaseService.init({ /* options */ });
// inside a React MFE
import { FirebaseAppProvider, useFirebaseApp } from '@nardole/firebase-react';

// Option A — wrap with the provider (reuses existing instance)
<FirebaseAppProvider options={{ /* same options */ }}>
  <YourApp />
</FirebaseAppProvider>

// Option B — if the provider isn’t available, you can still use the hook
const app = useFirebaseApp();

API

| Item | Props/Signature | Description | Notes/Errors | | --- | --- | --- | --- | | FirebaseAppProvider | <FirebaseAppProvider options: FirebaseOptions, name?: string, enableAnalytics?: boolean, enablePerformance?: boolean, enableRemoteConfig?: boolean, enableStorage?: boolean, enableAuth?: boolean, enableDatabase?: boolean, enableFirestore?: boolean> | React Provider that initializes and provides Firebase App via Context. It can also pre-instantiate and expose optional Firebase services via Context. | Internally calls firebaseService.init(options, name, true) when options/name change. Optional services are only available in Context if their respective enable flags are true. | | useFirebaseApp | useFirebaseApp(): FirebaseApp | Hook to get the current FirebaseApp from Context. | Throws if used outside a FirebaseAppProvider: "Firebase app isn't found, did you forget to wrap your app in " | | useAnalytics | useAnalytics(): Analytics | Hook to access Analytics from Context. | Throws if Provider not present or enableAnalytics not set. | | usePerformance | usePerformance(): FirebasePerformance | Hook to access Performance from Context. | Throws if Provider not present or enablePerformance not set. | | useRemoteConfig | useRemoteConfig(): RemoteConfig | Hook to access Remote Config from Context. | Throws if Provider not present or enableRemoteConfig not set. | | useStorage | useStorage(): FirebaseStorage | Hook to access Storage from Context. | Throws if Provider not present or enableStorage not set. | | useAuth | useAuth(): Auth | Hook to access Auth from Context. | Throws if Provider not present or enableAuth not set. | | useDatabase | useDatabase(): Database | Hook to access Realtime Database from Context. | Throws if Provider not present or enableDatabase not set. | | useFirestore | useFirestore(): Firestore | Hook to access Firestore from Context. | Throws if Provider not present or enableFirestore not set. |

Compatibility

  • Peer: react >=17, react-dom >=17, firebase ^12, @nardole/firebase-core ^1

Troubleshooting

  • Seeing "Firebase app already initialized" warnings/errors?
    • Ensure your MFEs share the same options and app name, or rely on the @nardole/firebase-core singleton. The Provider uses override to safely update when props change.

License

MIT