ideas
ideas copied to clipboard
useListeners
Not sure if generic Hooks like this will actually turn out to be helpful but throwing it out there.
import { useRef } from 'react'
function MyComponent() {
let node = useRef(null)
useListeners(node, [
['click', handleClick],
['mousedown', handleMousedown]
])
return <div ref={node} />
}
https://github.com/thchia/useListeners