const active = useRef(0);
...
active.current = active.current + 1; // это в коллбеке листенера
SELECT votes.user_id, users.name, users.surname, users.avatar, COUNT(votes.id) AS votes FROM votes, users WHERE users.id = votes.user_id GROUP BY votes.user_id LIMIT 50