Create a computed cell. Do not use cell.value inside the computation, always us get(cell) to unwrap cells to properly track dependencies.
cell.value
get(cell)
This is an alternative implementation of $ that doesn't rely on global state.
A function that can unwrap cells using get(cell) and compute a resulting value.
A cell that computes its value based on the provided computation function.
In the following example c and d are equivalent:
c
d
const a = cell(1);const b = cell(2);const c = computed(get => get(a) + get(b));const d = zipWith([a, b], (a, b) => a + b); Copy
const a = cell(1);const b = cell(2);const c = computed(get => get(a) + get(b));const d = zipWith([a, b], (a, b) => a + b);
Create a computed cell. Do not use
cell.value
inside the computation, always usget(cell)
to unwrap cells to properly track dependencies.This is an alternative implementation of $ that doesn't rely on global state.