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

results matching ""

    No results matching ""