IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

Reference a Document by id, passed from one view to another #110

Closed ChrisCross3 closed 3 years ago

ChrisCross3 commented 4 years ago

Good evening, I pass a Document id from one view to another an then want to get access to the Document.

Based on the documentation, I thought I could do this: const product = new Document('products/' + props.match.params.id)

The created object has the right path, but no data.

ATM I do it like this and it works: const product = products.docs.find( (doc) => doc.id == props.match.params.id);

Is this also an appropriate way?

IjzerenHein commented 3 years ago

Did you wrap your React component with observer ?