Contents
- Welcome to Domma Reactive
- 01 Getting started
- 02 Reactive state
- 03 HTML and bindings
- 04 Components
- 05 Reference
Your first reactive page
Updated by Darryl Waterhouse on 17 October 2026 · 1 min read
The smallest useful example has changing state, a derived value and HTML that reads them. A name input and a greeting are enough to see the relationship.
The view model
import {observable, computed, applyBindings} from 'domma-reactive';
const name = observable('Ada');
const greeting = computed(() => {
const person = name.value.trim();
return person ? `Hello, ${person}!` : 'Hello, stranger!';
});
const model = {
name,
greeting,
reset() { name.value = 'Ada'; }
};
const handle = applyBindings(model, document.querySelector('#app'));
The HTML
<main id="app">
<label>Your name <input data-model="name.value"></label>
<p data-bind-text="greeting.value"></p>
<button type="button" data-on-click="reset">Reset</button>
</main>
Run the script after the markup exists. A module script at the end of the body works. This code reads and writes the standalone observable through .value in both JavaScript and bindings.
Typing changes the name. The computed derives the message. Reset writes to the same name, so both the input and paragraph update. When the region is removed from a long-lived page, call handle.dispose() to release its bindings and listeners.
Run it and change it
Use Your first reactive page for the complete standalone file, a live version and three small exercises. The imports in the listing above assume a package resolver; the tutorial uses an explicit CDN URL.
Next, read Observables and computed values to understand the state behind the example, or build the contacts application to see the same pattern used in a larger page.
On this page