use-pipe-ts
v2.0.3
Published
Pipe-based useCallback react hook
Downloads
11
Readme
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