Skip to content

Commit

Permalink
move onMouseUp to component handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Jun 13, 2022
1 parent 7bf1aca commit 33cc091
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions components/WidthHandler.js
Expand Up @@ -34,14 +34,6 @@ export default function WidthHandler(props) {
return () => window.removeEventListener('mousemove', handleMouseMove)
}, [innerRef, onChange])

React.useEffect(() => {
function handleMouseUp() {
startX.current = null
}
window.addEventListener('mouseup', handleMouseUp)
return () => window.removeEventListener('mouseup', handleMouseUp)
}, [])

return (
// eslint-disable-next-line
<div
Expand All @@ -50,6 +42,9 @@ export default function WidthHandler(props) {
startX.current = e.pageX
startWidth.current = innerRef.current.clientWidth
}}
onMouseUp={() => {
startX.current = null
}}
role="separator"
aria-orientation="vertical"
aria-valuemin={minWidth}
Expand Down

0 comments on commit 33cc091

Please sign in to comment.