UNPKG

rooks

Version:

Essential React custom hooks ⚓ to super charge your components!

22 lines (21 loc) 598 B
import { useFreshRef } from "./useFreshRef"; /** * useFreshTick * @param callback The callback to be called on mount * @returns A fresh callback. * @see https://react-hooks.org/docs/useFreshCallback */ function useFreshTick(callback) { var freshRef = useFreshRef(callback); function tick() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (typeof freshRef.current === "function") { freshRef.current.apply(freshRef, args); } } return tick; } export { useFreshTick };