
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
outsideclick-react
Advanced tools
outsideclick-react is a lightweight React package that detects clicks outside a specified element, useful for dropdowns, modals, etc.
npm install outsideclick-react
or
yarn add outsideclick-react
import { useOutsideClick } from "outsideclick-react";
function MyComponent() {
const handleOutsideClick = (e) => {
// Handle outside click
};
const ref = useOutsideClick(handleOutsideClick);
/* const ref = useOutsideClick(handleOutsideClick, ".ignore-element") */
return <div ref={ref}>{/* Your component */}</div>;
}
import { OutsideClick } from "outsideclick-react";
function MyComponent() {
return (
<OutsideClick
onOutsideClick={() => {
// Handle outside click
}}
ignoreElement=".ignore"
>
<div>{/* Your component */}</div>
</OutsideClick>
);
}
useOutsideClickA hook that detects clicks outside of a specified element.
(v: HTMLElement) => void - A function that gets called when an outside click is detected.IgnoreElementType - An element or selector that should be ignored when detecting outside clicks.ref object that should be attached to the target element.OutsideClickA component that detects clicks outside of its children.
onOutsideClick: Function that is called when an outside click is detected.ignoreElement: An element or selector to ignore when detecting outside clicks.If you'd like to contribute, please submit a pull request.
If you want to support my work, you can buy me a coffee!
FAQs
A React utility hook for detecting outside clicks
We found that outsideclick-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.