UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

14 lines (13 loc) 507 B
import useMouseEvents from './useMouseEvents'; import useMouseState from './useMouseState'; /** * Returns an array where the first item is the mouse state from the `useMouseState` hook and the second item * is the object of callback setters from the `useMouseEvents` hook. * It is intended as a shortcut to those hooks. */ const useMouse = (targetRef) => { const state = useMouseState(targetRef); const events = useMouseEvents(targetRef); return [state, events]; }; export default useMouse;