I want to get all documents stored in firebase. If there are more than 0 documents, then render 1, otherwise print the no doc found but that gives me the error:
render() {
firebase
.firestore()
.collection("users")
.doc(localStorage.getItem("ph"))
.collection("chat")
.get()
.then(d => {
this.dt = d.docs.length;
if (this.dt > 0) {
return <div>1</div>;
} else {
return (
<div>
<div className="app-noFoundArea">
<img src={noFound} />
</div>
<div className="app-noFound-title">
<p>
No chat found. Try create using{" "}
<button className="app-add-icon app-nofound">
<i className="material-icons">add</i>
</button>
</p>
</div>
</div>
);
}
})
.catch(e => {});
}