Ref
Ref (short for reference) is a mutable object that allows you save value without any reactivity. This allows you to share data across multiple runs of an effects.
Also read Ref Advanced Guide.
ref()
Creates a new ref with the given value.
Signature:
ref(value: T): Ref<T>
Returns:
Example:
import { ref } from '@nalanda/core';
const getCountRef = ref(0);
Ref
Signature:
(store: EffectStore | Store) => {current: T}
Example:
import { ref } from '@nalanda/core';
const getCountRef = ref(0);
effect((store) => {
const counterRef = getCountRef(store);
counterRef.current++;
});