@kevin940726/use-lazy-ref
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

use-lazy-ref

A custom react hook equivalent of useRef but only lazily initialize once.

npm

Installation

yarn add @kevin940726/use-lazy-ref
npm install --save @kevin940726/use-lazy-ref

Usage

import useLazyRef from '@kevin940726/use-lazy-ref';

function App() {
  const ref = useLazyRef(() => expensiveCalculation());

  return ref.current;
}

Author

Kai Hao

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @kevin940726/use-lazy-ref

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

10.1 kB

Total Files

18

Last publish

Collaborators

  • kevin940726