A mutable reference container that holds a value of type A. This provides controlled mutability in a functional context.
const counter = Ref(0)counter.get() // 0counter.set(5)counter.get() // 5counter.update(n => n + 1)counter.get() // 6 Copy
const counter = Ref(0)counter.get() // 0counter.set(5)counter.get() // 5counter.update(n => n + 1)counter.get() // 6
Static
Compare and swap - only updates if current value equals expected
Get the current value
Update and return the old value
Modify the value and return a result
Set a new value
Update the value using a function
Update and return the new value
A mutable reference container that holds a value of type A. This provides controlled mutability in a functional context.
Example