We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c91cedb commit bb14da6Copy full SHA for bb14da6
1 file changed
src/App.tsx
@@ -103,10 +103,12 @@ function App() {
103
104
handleResize()
105
106
- window.addEventListener('resize', handleResize)
+ const observer = new ResizeObserver(handleResize)
107
+
108
+ observer.observe(canvasEl)
109
110
return () => {
- window.removeEventListener('resize', handleResize)
111
+ observer.disconnect()
112
}
113
}, [canvasEl])
114
0 commit comments