TypeError: Cannot read property ‘appendChild’ of null [closed]
I’m trying to create a blog where i get the information from Firestore database. But I keep getting this error. TypeError: Cannot read property 'appendChild' of null.
Here is my HTML code:
Here is the Firestore Database:
I think the error you are getting isn’t related to Firebase at all but rather to document.querySelector on line 16. The function expects a valid CSS selector to be passed, so if you want to find element by id you should prepend selector with “#”. In your case there is also a typo so at the end it should look like this to work:
let postCollection = document.querySelector('#post-collection');