Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

makefire

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makefire

React hooks for google cloud firestore database

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

makefire

This is a simple React hooks for google cloud firestore database.

Requirements

  1. Create a firebase project in firebase console
  2. Obtain firebase configuration for the project. You can find how to get the configuration on this link

Installation

npm install firebase makefire

Usage

Setup firebase with your app configuration and then create useDocument and useCollection hooks with makefire

import * as firebase from 'firebase/app'
import "firebase/firestore";
import makefire from 'makefire'


const firebaseConfiguration = {
  apiKey: '### FIREBASE API KEY ###',
  authDomain: '### FIREBASE AUTH DOMAIN ###',
  projectId: '### CLOUD FIRESTORE PROJECT ID ###'
};

firebase.initializeApp(firebaseConfiguration)
 
const db = firebase.firestore()

const { useDocument, useCollection } = makefire(db)

Now you can use them on your components. Insert the path for the collection or document in database as the first argument for the hooks.

function CoolComponent(props) {
  // subscribing to document 'bob' in 'users' collection
  const { data, loading, error } = useDocument('users/bob')

  // subscribing to 'users' collection
  const { data, loading, error } = useCollection('users')

  // subscribing to 'users' collection with additional queries
  const { data, loading, error } = useCollection('users', [['age', '>=', 21], ['location', '==', 'Jakarta']])
  
  ...
  );
}

Keywords

FAQs

Package last updated on 12 Jan 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc