
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
react-outside-event
Advanced tools
A higher order React component that attaches an event listener for events that occur outside of the component element.
A higher order React component that attaches an event listener for events that occur outside of the component element.
All DOM events that bubble are supported. By default, only "mousedown" event listener is attached. See supportedEvents parameter of the ReactOutsideEvent function.
/**
* @param {ReactClass} Target The component that defines `onOutsideEvent` handler.
* @param {String[]} supportedEvents A list of valid DOM event names. Default: ['mousedown'].
* @return {ReactClass}
*/
Define a component class and wrap it using ReactOutsideEvent. Your class must define onOutsideEvent method that will be invoked when an outside event occurs, e.g.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactOutsideEvent from 'react-outside-event';
class Player extends React.Component {
onOutsideEvent = (event) => {
// Handle the event.
}
render () {
return <div>Hello, World!</div>;
}
}
export default ReactOutsideEvent(Player, ['click']);
You can attach multiple event listeners at once and selectively handle events with a simple conditional logic, e.g.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactOutsideEvent from 'react-outside-event';
class Player extends React.Component {
onOutsideEvent = (event) => {
if (event.type === 'mousedown') {
} else if (event.type === 'mouseup') {
}
}
render () {
return <div>Hello, World!</div>;
}
}
export default ReactOutsideEvent(Player, ['mousedown', 'mouseup']);
npm run lint
npm run test
npm run build
npm run build
npm run start
FAQs
A higher order React component that attaches an event listener for events that occur outside of the component element.
We found that react-outside-event 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.