@wirestate/signals [monorepo] [docs]
Framework-agnostic Preact Signals exports for Wirestate services.
Use this package to create signal-based services once and share them across React and Lit applications. Pair it with @wirestate/react-signals to render React components or @wirestate/lit-signals to render Lit elements.
Install
bash
npm install @wirestate/core @wirestate/signalsStart
ts
import { Injectable } from "@wirestate/core";
import { Signal, signal } from "@wirestate/signals";
@Injectable()
class CounterService {
public readonly count: Signal<number> = signal(0);
public increment(): void {
this.count.value += 1;
}
}The same CounterService can now be consumed from a React component (via @wirestate/react-signals) or a Lit element (via @wirestate/lit-signals) without changes.
What Is Included
- Re-exports from
@preact/signals-core(signal,computed,effect,batch,untracked,action,createModel,Signal,ReadonlySignal, and related model types).
Learn More
License
MIT