I used addEventListener with resize event, but it doesn't work.
Other events like mouseup, mousemove, works really well.
useEffect(() => {
if (newWindowDocument) {
newWindowDocument.addEventListener('mouseup', handleMouseUpImage)
newWindowDocument.addEventListener('mousemove', handleMouseMoveImage)
}
return () => {
newWindowDocument?.removeEventListener('mouseup', handleMouseUpImage)
newWindowDocument?.removeEventListener('mousemove', handleMouseMoveImage)
}
}, [])
useEffect(() => {
if (newWindowDocument) {
newWindowDocument.addEventListener('resize', handleResize)
}
}, [scrollRef])
Is it natural that it can't detect it?
I used addEventListener with
resizeevent, but it doesn't work.Other events like
mouseup,mousemove, works really well.Is it natural that it can't detect it?