UNPKG

@dark-engine/core

Version:

The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)

13 lines (12 loc) 338 B
import { useMemo } from '../use-memo'; import { useCallback } from '../use-callback'; function useEvent(fn) { const scope = useMemo(() => ({ fn }), []); scope.fn = fn; const callback = useCallback((...args) => { return scope.fn(...args); }, []); return callback; } export { useEvent }; //# sourceMappingURL=use-event.js.map