Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 912 Bytes

useFirestore.md

File metadata and controls

47 lines (31 loc) · 912 Bytes

Table of Contents

useFirestore

React hook that return firestore object.

Examples

Basic

import React from 'react'
import { useFirestore } from 'react-redux-firebase'

export default function AddData() {
  const firestore = useFirestore()

  function addTodo() {
    const exampleTodo = { done: false, text: 'Sample' }
    return firestore.collection('todos').add(exampleTodo)
  }

  return (
    <div>
      <button onClick={addTodo}>
        Add Sample Todo
      </button>
    </div>
  )
}

Returns object Extended Firestore instance