title: Add a event to HTML element when it becomes on the user screen
body: <p>I want to add a event to HTML element when it becomes on the user screen using only Javascript or React components but not jQuery.</p>
  
  <blockquote>
    <p>I'm using react components and I want to run <code>setInterval()</code> function to
    make a simple counter using state, but the problem is the code runs
    when page is rendered, I want to start code only when the element
    becomes on the screen.</p>
  </blockquote>