🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

firestore-react

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firestore-react

Firestore bindings for React components using HOC

0.1.5
latest
Source
npm
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

Firestore Data Provider for React Component

firestore-react provides createContainer() function (inspired by Meteor) which creates a HOC to provide Firestore data for your React Components.

Provides two things

  • Fetches data and passes down to the presentational components
  • Adds a subscriber to listen to live snapshot updates on the query and also removes the subscriber when component is unmounted.

Installation

yarn add firestore-react

Examples

Simple List - Source Code


import createContainer from 'firestore-react';

class App extends React.Component {
  
  render() {
    // this.props.users.loading <= Gives you loading status
    // this.props.users.snapshot <= Gives you Firebase snapshot object of query and it automatically re-renders whenever snapshot updates
  }

}

const AppWithData = createContainer(App, (db) => {
  return {
    users: db.collection('users')
  }
})

Quick Demo

alt text

Keywords

Firebase

FAQs

Package last updated on 20 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts