title: Firebase firstore auto increment number not working (React js)
body: <pre><code>import firebase from 'firebase/compat/app';
  import 'firebase/compat/auth';
  import 'firebase/compat/firestore';
  import { doc, updateDoc,} from &quot;firebase/firestore&quot;;
  import { db } from &quot;../api/firebase_config&quot;;
  // const mydb = firebase.firestore()
  import React from 'react'
  const Mcheck = () =&gt; {
  async function ResetCounter() {
  // userRef.update({ FieldToIncrease: increment });
  const dataTable = doc(db, 'mycollection', 'Number');
  const increment = firebase.firestore.FieldValue.increment(1);
  console.log(increment)
  // await updateDoc(dataTable, data)
  const res = await updateDoc(dataTable, {
  sale: increment
  })
  }
  function checkClick() {
  ResetCounter()
  }
  return (
  &lt;div onClick={checkClick}&gt;&lt;input type={&quot;submit&quot;} value='check' /&gt;&lt;/div&gt;
  )
  }
  
  export default Mcheck
  </code></pre>
  <p>i searched for many solutions but its all say somthing like this. so if any one can help me then it will be very good form me.</p>
  <p><img src="https://i.stack.imgur.com/u8cDG.jpg" alt="here is the error log" /></p>