Jesus sucks
This commit is contained in:
28
backend/frontend/node_modules/@restart/hooks/cjs/useCallbackRef.d.ts
generated
vendored
Normal file
28
backend/frontend/node_modules/@restart/hooks/cjs/useCallbackRef.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* A convenience hook around `useState` designed to be paired with
|
||||
* the component [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) api.
|
||||
* Callback refs are useful over `useRef()` when you need to respond to the ref being set
|
||||
* instead of lazily accessing it in an effect.
|
||||
*
|
||||
* ```ts
|
||||
* const [element, attachRef] = useCallbackRef<HTMLDivElement>()
|
||||
*
|
||||
* useEffect(() => {
|
||||
* if (!element) return
|
||||
*
|
||||
* const calendar = new FullCalendar.Calendar(element)
|
||||
*
|
||||
* return () => {
|
||||
* calendar.destroy()
|
||||
* }
|
||||
* }, [element])
|
||||
*
|
||||
* return <div ref={attachRef} />
|
||||
* ```
|
||||
*
|
||||
* @category refs
|
||||
*/
|
||||
export default function useCallbackRef<TValue = unknown>(): [
|
||||
TValue | null,
|
||||
(ref: TValue | null) => void
|
||||
];
|
||||
Reference in New Issue
Block a user