I am trying to get the pageViews for the pages the visitors visit. But for some reason, the code increases only the first time. Can you please help, I am new to firebase and nextjs.
function handleViewsCounter(idRef) {
const idReference = fire.firestore().collection('blogs').doc(idRef)
return idReference.update({views: views + 1})
}
every time I click on the function, it should increase the views field in firebase, but that is not what is happening. It only increases one time and that gets sent to the firebase once.