npm.io
1.0.0-experimental.3 • Published yesterday

@wirestate/signals

Licence
MIT
Version
1.0.0-experimental.3
Deps
0
Size
6 kB
Vulns
0
Weekly
324

@wirestate/signals [monorepo] [docs]

npm license

Framework-agnostic Preact Signals exports for Wirestate services.

Use this package to author 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

npm install @wirestate/signals @preact/signals-core

Start

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

Keywords