Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

make-event-props

wojtekmaj6.8mMIT2.0.0TypeScript support: included

Returns an object with on-event callback props curried with provided args.

react, event, event props

readme

npm downloads CI

Make-Event-Props

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.

tl;dr

  • Install by executing npm install make-event-props or yarn add make-event-props.
  • Import by adding import makeEventProps from 'make-event-props'.
  • Create your event props object:
    const eventProps = useMemo(
      () => makeEventProps(props, (eventName) => additionalArgs),
      [additionalArgs],
    );
  • Use your event props:
    return <div {...eventProps} />;

License

The MIT License.

Author

Wojciech Maj Wojciech Maj