react-firestore-connect
react-firestore-connect copied to clipboard
Feature request: Maps of references
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,
)
I will have a look at this by the end of this month, but feel free to create PR if you'd like 🙂