
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
@react-hook/hover
Advanced tools
A React hook for tracking the hover state of DOM elements in browsers where hovering is possible
npm i @react-hook/hover
A React hook for tracking the hover state of DOM elements in browsers
where hovering is possible. If the browser does not support hover states
(e.g. a phone) the isHovering
value will always be false
.
Check out the example on CodeSandbox
import * as React from 'react'
import useHover from '@react-hook/hover'
const Component = (props) => {
const target = React.useRef(null)
const isHovering = useHover(target, {enterDelay: 200, leaveDelay: 200})
return <div ref={target}>{isHovering ? 'Hovering' : 'Not hovering'}</div>
}
function useHover<T extends HTMLElement>(
target: React.RefObject<T> | T | null,
options: UseHoverOptions = {}
): boolean
Argument | Type | Required? | Description |
---|---|---|---|
target | React.RefObject | T | null | Yes | A React ref created by useRef() or an HTML element |
options | UseHoverOptions | Yes | Configuration options for the hook. See UseHoverOptions below. |
boolean
This hook returns true
if the element in ref
is in a hover state, otherwise false
. This value
is always false
on devices that don't have hover states, i.e. phones.
Property | Type | Description |
---|---|---|
enterDelay | number | Delays setting isHovering to true for this amount in ms |
leaveDelay | number | Delays setting isHovering to false for htis amount in ms |
MIT
FAQs
A React hook for tracking the hover state of DOM elements in browsers where hovering is possible
We found that @react-hook/hover demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.