I have a function component in react... so it redraws when parent data changes.
Inside the component i have this
const num = Math.floor((Math.random() * 100) + 1);
console.log("set num", num);
window.removeEventListener("resize", function(){});
window.addEventListener('resize', function(){
console.log(num);
})
This is just to illustrate the problem, but... it creates a new window resize event every time the component redraws... why? And, how do I stop it?