Populate Key Within Items in a List

Populate the owner of each item in a todos list from the 'users' root.


Populate List of Items
import { compose } from 'redux'
import { connect } from 'react-redux'
import { firebaseConnect, populate } from 'react-redux-firebase'

const populates = [
  { child: 'owner', root: 'users' }

const enhance = compose(
    { path: 'todos', populates }
    ({ firebase }) => ({
      todos: populate(firebase, 'todos', populates),

export default enhance(SomeComponent)

Populate Profile Parameters

To Populate parameters within profile/user object, include the profileParamsToPopulate parameter when calling reactReduxFirebase in your compose function as well as using populate.

NOTE Using profileParamsToPopulate no longer automatically populates profile, you must use populate. Un-populated profile lives within state under state.firebase.profile.


Populate Role

Populating a user's role parameter from a list of roles (under roles collection).

export const profilePopulates = [{ child: 'role', root: 'roles' }]
const config = {
  userProfile: 'users',
  profileParamsToPopulate: profilePopulates // populate list of todos from todos ref

// Wrapping some component
  ({ firebase }) => ({
    profile: firebase.profile,
    populatedProfile: populate(firebase, 'profile', profilePopulates),

results matching ""

    No results matching ""