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

firebase-sync

v1.4.10

Published

firebase-sync React component

Readme

Bind your firebase backend to your redux state with a dead simple component based approach.

Table of Contents

Setting up

Setting up with Immutable.js

Your first synced component

Documentation

Setting up

First you must add the firebase-sync reducer to your app's reducers.

  import { combineReducers } from 'redux';
  import { getFirebaseSyncReducer } from 'firebase-sync';
  
  combineReducers({
    // ...your other reducers go here
    firebase: getFirebaseSyncReducer()
  })

Then you would normally setup the firebase-sync component, selector and map state util. These will then be used throughout your app.

// ./lib/FirebaseSync.js

import store from './my-redux-store';
import firebase from '/my-initialized-firebase-app';
import buildFirebaseSync from 'firebase-sync';

// the reducer name you have used in your root reducer.
const reducerName = 'firebase';

const {
  FirebaseSync,
  firebaseSyncConnect
} = buildFirebaseSync({ firebase, store, reducerName });

export { FirebaseSync, firebaseSyncConnect };

Setting up with Immutable.js

(If you're not using Immutable.js you can skip to the Getting Started guide.

First you must add the firebase-sync reducer to your app's reducers. You must pass in a Map object so we can use it as the reducer's initial state.

  import { combineReducers } from 'redux';
  import { getFirebaseSyncReducer } from 'firebase-sync';
  import { Map } from 'immutable';
  
  combineReducers({
    // ...your other reducers go here
    firebase: getFirebaseSyncReducer(Map())
  })

Then you would normally setup the firebase-sync component and selector. These components will then be used throughout your app. Since you're using Immutable.js you must pass in a onPostProcessItem function to the component defaultProps. This way everything is saved as an Immutable object on your app's state.

// ./lib/FirebaseSync.js

import store from './my-redux-store';
import firebase from '/my-initialized-firebase-app';
import buildFirebaseSync from 'firebase-sync';

import { fromJS } from 'immutable';

// the reducer name you have used in your root reducer.
const reducerName = 'firebase';

const {
  FirebaseSync,
  firebaseSyncConnect
} = buildFirebaseSync({
  firebase,
  store,
  reducerName,
  defaultProps: {
    onPostProcessItem: fromJS
  }
});

export { FirebaseSync, firebaseSyncConnect };

Your first synced component

We will build a simple user profile component that syncs the user object from your firebase database. There are two things that you should notice:

  • we're using the absence of the user object on our state to show our loading state.
  • our database object key is automatically saved on a special _key prop. We provide a lot more of this utilities.
import React from 'react'
import { connect } from 'react-redux'
import { FirebaseSync, firebaseSyncConnect } from '../lib/FirebaseSync'

const User = (props) => (
  <div>
  
    <FirebaseSync path=`users/${props.userId}` />
    
    {(!props.user) ? (
      <p>loading…</p>
    ) : (
      <p>
        <h1>User name: {props.user.name}</h1>
        <p>User id: {props.user._key}</h1>
      </p>
    )}
  
  </div>
)

export default firebaseSyncConnect((state, props) => ({
  user: `users/${props.userId}`
})(User)

Documentation

Check out our full documentation on the wiki. Or go directly to our Full API.