Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 687 Bytes

README.md

File metadata and controls

33 lines (22 loc) · 687 Bytes

@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!"