Creates a new Observable whose value is derived from another Observable. The new Observable automatically updates and notifies listeners whenever the source Observable changes.
The source Observable to derive the value from.
A function that takes the value of the source Observable and returns the derived value.
A new Observable that will contain the derived value.
const value = createObservable(2);// Create a derived observable that is true if value > 5const isGreater = compute(value, (v) => v > 5);// isGreater.value == falsevalue.dispatch(6);// isGreater.value == true Copy
const value = createObservable(2);// Create a derived observable that is true if value > 5const isGreater = compute(value, (v) => v > 5);// isGreater.value == falsevalue.dispatch(6);// isGreater.value == true
Creates a new Observable whose value is derived from another Observable. The new Observable automatically updates and notifies listeners whenever the source Observable changes.