Reactjs – State variable gives old value when the function is added to a event listener
In the below given react.js code, I am fetching some data on page load. I have used arePostsLoading state variable to track if the data is loaded or not. I have also added a function handleScroll which tracks scrolling and…