Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
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.
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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.