
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-atom-trigger
Advanced tools
React component to execute code when you scroll to an element. Simple react-waypoint alternative in typescript.
AtomTrigger helps solve the problem of executing code when some element "scrolls into (or out of) view". A pretty simple "react-waypoint" alternative written in Typescript.
Exposes <AtomTrigger {...props} /> component, where props are:
interface IAtomTriggerProps {
scrollEvent: ScrollEvent;
dimensions: Dimensions;
behavior?: 'default' | 'enter' | 'leave';
callback: () => unknown;
getDebugInfo?: (data: DebugInfo) => void;
triggerOnce?: boolean;
className?: string;
offset?: [number, number, number, number];
}
In order to "work" AtomTrigger needs callback, dimensions and simple scroll event data provided.
The function to be executed when AtomTrigger enters or leaves some container.
callback: () => unknown;
Dimensions of the main "container" (window in many cases).
type Dimensions = {
width: number;
height: number;
};
So if you have some logic of calculating container size and container resize handling, just provide needed data to AtomTrigger.
To trigger "events" AtomTrigger needs some kind of simple scroll event provided.
type ScrollEvent = {
scrollX: number;
scrollY: number;
};
So, if you already have some scroll event listener, just provide it to AtomTrigger.
For someone who wants everything out-of-the-box, useWindowDimensions, useWindowScroll and useContainerScroll hooks are also available for import.
This package is built with tsdown.
Build output:
lib/index.js
lib/index.es.js
lib/index.d.ts
When the UMD bundle is loaded directly in the browser, the library is exposed as window.reactAtomTrigger.
It is sometimes better to tweak and see for yourself: CodeSandbox examples.
FAQs
React component to execute code when you scroll to an element. Simple react-waypoint alternative in typescript.
We found that react-atom-trigger demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.