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-react-redux

v0.0.2

Published

easily bind your firebase backend to your react-redux based app

Readme

firebase-react-redux

This lib focus on binding your redux state to your firebase backend. We do this with a component based approach so that all fetch/sync/unsync operations are done when a component of yours is mounted or unmounted.

We provide a single FBSync component that you may use directly or by wrapping it with a predefined setup and exporting it as your own component. We recommended that you use the latter for a more scalable application.

Examples

direct use - for getting your feet wet

  import React from 'react';
  import FBSync from 'firebase-react-redux';
  import { connect } from 'react-redux';
  
  const MyPosts = ({ myPosts }) => (
    <section>
      
      // syncs all posts
      // saves them as an array of objects ordered by the 'updatedAt' prop
      <FBSync
        path='myPosts'
        orderBy='updatedAt' />
      
      {myPosts.map((post) => {
        <article>
          <h1>{post.title}</h1>
          <time>{post.updatedAt}</time>
          <p>{post.body}</p>
        </article>
      })}

    </section>
  )

  export default connect((state) => {
    myPosts: state.fb.myPosts
  })(MyPosts);

wrapped - for scalable applications

  
  // syncs post object
  const FBPost = ({ postId }) => (
    <FBSync path={`posts/${postId}`} />
  )
  
  // fetches an user only if not already on state
  // if fetch was set to 'hard' or true we would always fetch it from the database
  const FBUser = ({ userId }) => (
    <FBSync fetch='soft' path={`users/${userId}`} />
  )
  
  const Post = ({ postId, post, user }) => (
    <article>
      
      <FBPost postId={postId} />
      
      {(!post) && (
        <p>loading…</p>
      )}
      
      {(post) && (
        <div>
        
          <FBUser userId={post.createdBy} />
      
          <h1>{post.title}</h1>
          <author>{user ? user.name : 'loading…'}</author>
          <p>{post.body}</p>
          
        </div>
      )}

    </article>
  )

  export default connect((state, props) => {
    const post = state.fb.posts[props.postId];
    return {
      post: post,
      user: post && state.fb.users[post.createdBy]
    };
  })(Post);

Setup

Just add our reducer to your rootReducer and optionally pass in a custom binding for immutable states.

mutable

  import { combineReducers } from 'react-redux';
  import { firebaseReactReduxReducer } from 'firebase-react-redux';
  
  combineReducers(
    …,
    fb: firebaseReactReduxReducer()
  )

immutable

  import { combineReducers } from 'react-redux';
  import { firebaseReactReduxReducer, firebaseReactReduxImmutable } from 'firebase-react-redux';
  
  combineReducers(
    …,
    fb: firebaseReactReduxReducer(firebaseReactReduxImmutable)
  )