@gluonjs/reactivity / packages/reactivity/src/preact-signals / fromPreactSignal
Function: fromPreactSignal()
Call Signature
fromPreactSignal<
T>(source,options?):WritableSignalBridge<T>
Type Parameters
T
T
Parameters
source
Signal<T>
options?
Returns
Call Signature
fromPreactSignal<
T>(source,options?):SignalBridge<T>
Type Parameters
T
T
Parameters
source
ReadonlySignal<T>
options?
Returns
SignalBridge<T>
Example
Connect a real Preact computed signal to Gluon without making Preact part of the stable Reactivity entry:
import { computed, signal } from '@preact/signals-core';
import { fromPreactSignal } from '@gluonjs/reactivity/preact-signals';
const quantity = signal(1);
const total = computed(() => quantity.value * 48);
const bridge = fromPreactSignal(total, { connect: true });
quantity.value = 2;
console.log(bridge.value);
bridge.disconnect();