How can I route change when scroll up and down with infinite scroll using intersection observer with reactjs?