1.3.0 • Published 2 years ago

@react-hookbox/event-callback v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@react-hookbox/event-callback

Material UI's useEventCallback with better type definitions.

NPM Minzipped Bundle Size

Install

npm install --save @react-hookbox/event-callback

or

yarn add @react-hookbox/event-callback

Usage

both for JavaScript and Typescript:

import { useEventCallback } from '@react-hookbox/event-callback';
// OR
// import useEventCallback from '@react-hookbox/event-callback';

// then
const myCallback = useEventCallback((num, str) => {
  return str.repeat(Math.min(num, 2));
});

useEventCallback updates the callback it's using after an "effective-time". So make sure to use it as a callback or in a useEffect which is placed after useEventCallback;

Params

  • fn. This is a required function parameter. The returned value will have the same type.

    Note: The return value will be updated after an "effect-ive time".

    That means the returned value should be used as an event callback or in an event callback.

License

MIT © hakobpogh

1.3.0

2 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago