use-pipe-ts
Pipe-based useCallback react hook
Getting started
$ npm i use-pipe-ts
Overview
export function usePipe(...fns) {
return useCallback(
pipe(...fns.map((fn) => (typeof fn === 'function' ? fn : subst(...fn)))),
fns.flat()
)
}
function subst(fn, ...subs) {
return (...args) => fn(...subs, ...args)
}
Usage
See test