title: How real time data update works in React js?
body: <p>Suppose I am consuming an API and getting it's data as:</p>
  <pre><code>{USA:12,IND:21,NEP:90,ENG:81}
  </code></pre>
  <p>after sometimes it's data changes to :</p>
  <pre><code>{USA:2,IND:1,NEP:0,ENG:1}
  </code></pre>
  <p>and so on...its data is continuously changing, I have created an table in react which shows data for these countries and is updating the table's data every time there is change in data.</p>
  <p>Now, I want to know how does table update the data in real time without reloading the page or clicking any button, but by itself.</p>
  <p>Is it listening to  API every time i.e. making API call continuously, and it fetching data continuously and when there is change in data updates the component or what actually is happening?</p>
  <p>This was a question asked to me during interview for which I told that it is continuously calling API and when data changes it updates the table but I'm not sure if this is correct answer or not … or how it actually happens?</p>
  <p>If anyone could provide me some article that I can refer to or provide me explanation that would be great.</p>
  <p>If anyone needs anymore information please let me know.</p>