Signals

Signals are fine-grained reactive cells serialized in the resumability payload and resumed on the client.

use_signal

let count = use_signal(0);

count.set(5);
count.update(|c| *c += 1);
let current = count.get();

In templates

Interpolating {count} in view! renders the current value and registers a subscription.

view! {
    <p>"Count: " {count}</p>
    <button onClick={ move |_| count.update(|c| *c += 1) }>
        "+"
    </button>
}

ReadSignal and WriteSignal

Split a signal when you want read-only or write-only access — useful for passing props to child components.

let count = use_signal(0);
let (read, write) = count.split();

// read.get() — read-only
// write.set(n) / write.update(...) — write-only

Serialization

Signal values must implement Serialize. They travel in the resuma/state script tag and sync on the client after resume.