
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
react-mouse-aware
Advanced tools
A tiny higher order component to track mouse state.
import { Component } from 'react';
import { mouseAware } from 'react-mouse-aware';
@mouseAware({ // same as default options
inDelay: 0,
outDelay: 0,
inHandler: 'onMouseEnter',
outHandler: 'onMouseLeave',
key: 'isOver'
})
@mouseAware({
inDelay: 300,
outDelay: 100,
inHandler: 'onMouseDown',
outHandler: 'onMouseUp',
key: 'isPressed'
})
class CustomComponent extends Component {
render() {
// props will include the in and out handlers
let { isOver, isPressed, className, ...props } = this.props;
if (isOver) className += ' hovered'; // mouse is over component
if (isPressed) className += ' active'; // mouse has been held down for 300ms or was just released
return (
<div {...props} className={className}>
</div>
)
}
};
@mouseAware(options)
export default class Test extends React.Component {
/* your code */
}
class Test extends React.Component {
/* your code */
}
export default mouseAware(options)(Test);
inDelay
defaults to 0
Time in ms
to wait before setting the active
status to true
.
outDelay
defaults to 0
Time in ms
to wait before setting the active
status to false
.
inHandler
defaults to 'onMouseEnter'
Property name to expose the inHandler
as.
outHandler
defaults to 'onMouseLeave'
Property name to expose the outHandler
as.
openFunction
no defaultProperty name to expose the force open function as. This function will ignore the in delay
closeFunction
no defaultProperty name to expose the force close function as. This function will ignore the out delay.
key
defaults to 'isOver'
Property name to expose the active
status as.
FAQs
A tiny higher order component to track mouse state.
The npm package react-mouse-aware receives a total of 434 weekly downloads. As such, react-mouse-aware popularity was classified as not popular.
We found that react-mouse-aware 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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.