Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@leafygreen-ui/hooks
Advanced tools
Hook to subscribe to changes in a ref
const Example = () => {
[refNode, setRefNode] = useElementNode();
return <div ref={setRefNode}>I am a ref</div>;
};
Hook to create and remove eventListeners
useEventListener('click', handleClick, { enabled });
Prop | Type | Description | Default |
---|---|---|---|
type | Global Event Handler or string | Type of event to listen for. | |
eventCallback | function | Callback executed when event is triggered. | |
optional.options | AddEventListenerOptions | Parameter to specify options passed to the eventListener | |
optional.enabled | boolean | Determines whether the event handler is attached or not. | true |
optional.dependencies | Array | Array to be passed to useEffect hook, such that the hook will only run if the array's values have changed. | [enabled, type] |
optional.element | Document or HTMLElement | The DOM node to attach the event handler to. Defaults to document . | document |
Hook that listens for EscapeKey
press.
useEscapeKey(handleEscapeCallback);
Prop | Type | Description | Default |
---|---|---|---|
callback | function | Callback executed when EscapeKey is pressed. | |
optional | object | Optional argument passed to function with implementation specifications. See supported parameters for useEventHandler. |
const lastTimeContentElMutated = useMutationObserver(
target,
mutationOptions,
() => Date.now(),
adjustOnMutation,
);
Prop | Type | Description | Default |
---|---|---|---|
target | HTMLElement or null | HTMLElement to subscribe to changes to. | |
options | MutationObserverInit | Object with information about what DOM changes to subscribe to. Docs here | |
callback | function | Callback function to execute inside of MutationObserver instance. | |
enabled | boolean | Determines whether the event handler is attached or not. | true |
Hook to subscribe to changes in viewport size
const viewportSize = useViewportSize();
FAQs
LeafyGreen UI Kit Custom Hooks
The npm package @leafygreen-ui/hooks receives a total of 56,198 weekly downloads. As such, @leafygreen-ui/hooks popularity was classified as popular.
We found that @leafygreen-ui/hooks demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.