Share a reactive value with createPulse
Share one counter value and publish its changes to a mounted view.
The example increments the current value and renders `Count: 1`; a separate path can rerun subscribers without changing that value.
Table of contents
Main APIs
- createPulse
- Creates one reactive value and returns `read()`, `write(...)` and `runSubscribers()`.
tsimport { mount } from "valyrian.js";
import { createPulse } from "valyrian.js/pulses";
const [count, setCount] = createPulse(0);
setCount((current) => current + 1);
mount("body", () => `Count: ${count()}`);Limit
Use `runSubscribers()` only when you need recomputation without a value change.