useEffect being weir - EventListener
So... I have this listener that listens for the position of selectedItem when I scroll on its parent. Why is it not unbinding when selectedItem changes? the cleanup function doesn't work. I have no idea of what is wrong lol.
when I change the selectedItem, it creates a new listener for that and they keep stacking.
please send help. images attached.
when I change the selectedItem, it creates a new listener for that and they keep stacking.
please send help. images attached.



