File size: 692 Bytes
bf237c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { registerAction, hoverAction } from '@use-gesture/core/actions'
import { EventTypes, UserHoverConfig, Handler } from '@use-gesture/core/types'
import { useRecognizers } from './useRecognizers'
/**
* Hover hook.
*
* @param {Handler<'hover'>} handler - the function fired every time the hover gesture updates
* @param {UserHoverConfig} config - the config object including generic options and hover options
*/
export function useHover<EventType = EventTypes['hover'], Config extends UserHoverConfig = UserHoverConfig>(
handler: Handler<'hover', EventType>,
config?: Config
) {
registerAction(hoverAction)
return useRecognizers({ hover: handler }, config || {}, 'hover')
}
|