Table of Contents

firestoreConnect

Extends React.Component

Higher Order Component that automatically listens/unListens to provided Cloud Firestore paths using React's Lifecycle hooks. Make sure you have required/imported Cloud Firestore, including its reducer, before attempting to use. Note Populate is not yet supported.

Parameters

  • queriesConfig (Array | Function) Array of objects or strings for paths to sync from Firebase. Can also be a function that returns the array. The function is passed the current props and the firebase object. (optional, default [])

Examples

Basic

// props.firebase set on App component as firebase object with helpers
import { firestoreConnect } from 'react-redux-firebase'
export default firestoreConnect()(SomeComponent)

Basic

import { connect } from 'react-redux'
import { firestoreConnect } from 'react-redux-firebase'

// pass todos list from redux as props.todosList
export default compose(
  firestoreConnect(() => ['todos']), // sync todos collection from Firestore into redux
  connect((state) => ({
    todosList: state.firestore.data.todos
  })
)(SomeComponent)

Returns Function Function which accepts a component to wrap and returns the wrapped component

Render component wrapped in context

Parameters

  • props object Component props

Returns React.Component Component wrapped in context

results matching ""

    No results matching ""