New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@react-hookbox/enhanced-callback

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hookbox/enhanced-callback

The enhanced version of useCallback that doesn't need deps array and keeps reference the same.

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

@react-hookbox/enhanced-callback

The enhanced version of useCallback. Enhanced callback doesn't need deps array and keeps reference the same.

NPM Minzipped Bundle Size

Install

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

or

yarn add @react-hookbox/enhanced-callback

Usage

both for JavaScript and Typescript:

import { useEnhancedCallback } from '@react-hookbox/enhanced-callback';
// OR
// import useEnhancedCallback from '@react-hookbox/enhanced-callback';

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

// this will work everywherre in you code
myCallback(8, 'hello');

useEnhancedCallback updates the callback immediately so you can use it anytime you want. Just keep in mind that you should not rely on it to trigger update in any deps list as it returns the same function-reference and never changes it.

Params

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

License

MIT © hakobpogh

Keywords

@react-hookbox

FAQs

Package last updated on 10 Jun 2022

Did you know?

Socket

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.

Install

Related posts