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.
make-event-props
Advanced tools
Returns an object with on-event callback props curried with provided args.
The make-event-props npm package is designed to help developers create event properties for React components. It simplifies the process of binding event handlers to components by generating the necessary props for a given set of event names.
Generate Event Props
This feature allows you to generate event properties for a set of event names. You provide the event names and corresponding handlers, and the package returns an object with the event properties.
const makeEventProps = require('make-event-props');
const eventNames = ['onClick', 'onMouseEnter'];
const eventHandlers = {
onClick: () => console.log('Clicked!'),
onMouseEnter: () => console.log('Mouse Entered!')
};
const props = makeEventProps(eventNames, eventHandlers);
console.log(props); // { onClick: [Function], onMouseEnter: [Function] }
Filter Event Handlers
This feature allows you to filter and include only the event handlers that match the provided event names. It helps in managing and organizing event handlers efficiently.
const makeEventProps = require('make-event-props');
const eventNames = ['onClick', 'onMouseEnter', 'onMouseLeave'];
const eventHandlers = {
onClick: () => console.log('Clicked!'),
onMouseEnter: () => console.log('Mouse Entered!'),
onMouseLeave: () => console.log('Mouse Left!')
};
const props = makeEventProps(eventNames, eventHandlers);
console.log(props); // { onClick: [Function], onMouseEnter: [Function], onMouseLeave: [Function] }
The react-event-listener package provides a way to manage global event listeners in a React application. Unlike make-event-props, which focuses on generating event props for components, react-event-listener is more about attaching and managing global event listeners.
A function that, given props, returns an object of event callback props optionally curried with additional arguments.
This package allows you to pass event callback props to a rendered DOM element without the risk of applying any invalid props that could cause unwanted side effects.
npm install make-event-props
or yarn add make-event-props
.import makeEventProps from 'make-event-props'
.const eventProps = useMemo(
() => makeEventProps(props, (eventName) => additionalArgs),
[additionalArgs],
);
return <div {...eventProps} />;
The MIT License.
Wojciech Maj |
FAQs
Returns an object with on-event callback props curried with provided args.
The npm package make-event-props receives a total of 0 weekly downloads. As such, make-event-props popularity was classified as not popular.
We found that make-event-props 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
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.