Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 620,029 weekly downloads. As such, make-event-props popularity was classified as 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.