i want to add a event to HTML element when it becoms on the user screen using only javascript or React componentes but not jQuery.
i'm using react components and i want to run setInterval() 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.