1.0.2 • Published 2 years ago

@jdthornton/usecallbackref v1.0.2

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

@jdthornton/usecallbackref

npm (scoped) npm bundle size (minified)

React callback ref hook.

Install

$ npm install @jdthornton/usecallbackref

Usage

import useCallbackRef from "@jdthornton/usecallbackref";

function App(){
  const ref = useCallbackRef(() => {
    console.log("It's a reference!")
  })

  useEffect(() => {
    ref.current();
  },[ref]);

  return null
}

//=> "It's a reference!"