Const
Combines an array of ReadableLikes into a single Readable with transformed value.
Note that changes to transform and config will not trigger re-derivation; useCombine always uses the latest transform and config in the derivation.
transform
config
useCombine
An array of ReadableLikes to combine. It follows the React rules of hooks where the length of the array must remain constant.
Optional pure function that takes multiple values and returns a new value.
Optional custom Config.
An OwnedReadable with the transformed values.
import { useCombine, useValue } from "@embra/reactivity/react";function App({ width$, height$ }) { const size$ = useCombine( [width$, height$], ([width, height]) => ({ width, height }), { equal: (s1, 22) => s1.width === s2.width && s1.height === s2.height } ); const size = useValue(size$);} Copy
import { useCombine, useValue } from "@embra/reactivity/react";function App({ width$, height$ }) { const size$ = useCombine( [width$, height$], ([width, height]) => ({ width, height }), { equal: (s1, 22) => s1.width === s2.width && s1.height === s2.height } ); const size = useValue(size$);}
Combines an array of ReadableLikes into a single Readable with transformed value.
Note that changes to
transformandconfigwill not trigger re-derivation;useCombinealways uses the latesttransformandconfigin the derivation.