Recomputed
Simple "computed" for React inspired by reselect.
; Component { superprops; const composer = ; thisgetSlice = ; // compose with existed computed thisgetSliceSum = ; // use decorator thisgetSelected = ; }
API
recomputed(computeContext: any)
Take one computeContext, return a composer function which can create computed.
composer(...inputFunc, resultFunc)
Takes one or more input function, computes their values and passes them as arguments to resultFunc.
; const composer = ; thisgetOddNums = ;
property(param)
if param
is a string, creates a Input that returns the param
property of given object.
const input = ;inputvalue name: 'foo ' // return foo
if param
is a function, creates a Input that returns the result of param
call with given object.
const input = ;inputvalue name: 'foo ' // return foo