Skip to content

duongvanba/firebase-easy-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase hookm for react

1. Install

yarn add firebase-easy-hooks

2. Using

Auth

import { useAuth } from 'firebase-easy-hooks'
const { user, loading, claims } = useAuth()

Render collection

import { useCollectionData } from 'firebase-easy-hooks'
const { data, loading, error, fetch_more, has_more, empty, add } = useCollectionData('users/random_user_id/payments')

// data: List items array
// loading: boolean
// fetch_more: Load more data
// has_more: boolean 
// empty == true if no items in list
// add : Add new document to collections

Render document

import { useDocumentData } from 'firebase-easy-hooks'
const { data, loading, error  } = useDocumentData('users/random_user_id/payments/paymentX')

// data: List items array
// loading: boolean

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published