Skip to content

Feature request: Maps of references #1

@loicnico96

Description

@loicnico96

Example usage:

Let's say I have a (dynamic) list of several user IDs that I can give to my components. My components needs additional information that are contained in sub-collections of these users. In this case, I cannot use the current Array functionality because I will not be able to tell which sub-document corresponds to each user (I cannot use the document ID because it will be the ID within the sub-collection, not the ID of the parent user).

export default connectFirestore(
  (db, props) => ({
    subRefs: props.users.reduce((refs, user) =>
      Object.assign(refs, {
        [user.id]: getSubCollectionRef(db, user.id, props.something)
      }), {}),
  }),
  MyComponent,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions