title: React.js "useEffect" infinitive loop
body: <p>I'm using a function which needs to update data table and gets values from an API using fetch. When the page uploads, data comes perfectly with useEffect but i want it to be uploaded when i delete or add item into the table which doesn't work right now as it goes into infinitive loop.</p>
  <pre><code>const [data,setData] = useState();
  
  
   useEffect(() =&gt; {
     
     PersonService.getAllPersonList()
     .then(res =&gt; {
       setData(res)
       console.log(res)
     }
   )
   }, [data]); 
  </code></pre>