useMemoizedCallback react hook
Install it with yarn:
yarn add use-memoized-callback
or with npm:
npm i use-memoized-callback --save
*For more information about callback memoization read this article.
Example
;; { const counter setCounter = ; const incCounter = ; // no dependency required return <div> /* incCounter is memoized so AnotherComponent will not reRender each time. */ <AnotherComponent onClick=incCounter /> </div> ;}