Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 369 Bytes

use-callback-const.md

File metadata and controls

16 lines (12 loc) · 369 Bytes

useCallbackConst

Creates a callback with a constant value over the lifecycle of a component.

Example

const immutableCallback = useCallbackConst(() => {
  console.log(
    `I don't have any local state dependencies
    and I won't trigger unncessary re-renders.`
  );
});

<button onClick={immutableCallback}>Click me to increment: {count}</button>