UNPKG

victory-native

Version:

A charting library for React Native with a focus on performance and customization.

12 lines (9 loc) 293 B
import * as React from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const useFunctionRef = <Fn extends (...args: any[]) => any>(fn?: Fn) => { const fnRef = React.useRef(fn); React.useEffect(() => { fnRef.current = fn; }, [fn]); return fnRef; };