getMyArticles = () => {
db
.collection ( collectionPath : "Articles" ) : CollectionReference < DocumentData >
.limit(limit: 8 ) Query<DocumentData>
.get() Promise<QuerySnapshot<Document>>
.then(docs => {
if(!docs.empty){
let allArticles = []
docs.forEach(callback: function (doc: QueryDocumentSnapshot<DocumentData>) => {
const article = {
id: doc,
...doc.data()
}
allArticles.push(article)
}
this.setState(state : {
articles: allArticles
}, callback: () => {
this.setState(
state: {
isLoaded: true
})
})
}
})
}