Ref
Index
Accessor
modify
- const ref = Ref('foo');Ref.modify(ref, (current) => current + 'bar'); // Ref.read(ref) == 'foobar'
read
Returns the current ref value
const ref = Ref('foo');Ref.read(ref); // 'foo'
write
Change the current value
const ref = Ref('foo');Ref.write(ref, 'bar'); // Ref.read(ref) == 'bar'
Type
hasInstance
Returns
truewhenanyValuehas acurrentpropertyRef.hasInstance(Ref(123)) // trueRef.hasInstance(null)) // false
Other
current
Current value symbol
property
- const parent = Ref({ foo: true });const child = Ref.property(parent, 'foo');// Ref { current: true }
Change the current value using a mapping function that returns the new value