Table of Contents

isLoaded

Detect whether items are loaded yet or not

Parameters

  • args ...any
  • item Object Item to check loaded status of. A comma separated list is also acceptable.

Examples

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { firebaseConnect, isLoaded } from 'react-redux-firebase'

Returns Boolean Whether or not item is loaded

isEmpty

Detect whether items are empty or not

Parameters

  • args ...any
  • item Object Item to check loaded status of. A comma seperated list is also acceptable.

Examples

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { firebaseConnect, isEmpty } from 'react-redux-firebase'

Returns Boolean Whether or not item is empty

populate

Convert parameter under "data" path of Immutable Object to a Javascript object with parameters populated based on populates array

Parameters

  • state
  • path String Path of parameter to load
  • populates Array Array of populate objects
  • notSetValue (Object | String | Boolean) Value to return if value is not found
  • firebase Object Immutable Object to be converted to JS object (state.firebase)

Examples

Basic

import { connect } from 'react-redux'
import { firebaseConnect } from 'react-redux-firebase'
const populates = [{ child: 'owner', root: 'users' }]

const fbWrapped = firebaseConnect([
  { path: '/todos', populates } // load "todos" and matching "users" to redux
])(App)

export default connect((state) => ({
  // this.props.todos loaded from state.firebase.data.todos
  // each todo has child 'owner' populated from matching uid in 'users' root
  // for loading un-populated todos use state.firebase.data.todos
  todos: populate(state.firebase, 'todos', populates),
}))(fbWrapped)

Returns Object Data located at path within Immutable Object

results matching ""

    No results matching ""