Getting Started
Installation
Section titled “Installation”npm install @rimitive/core @rimitive/signals @rimitive/viewYour First App
Section titled “Your First App”Create a counter with reactive state and DOM rendering:
import { compose } from '@rimitive/core';import { SignalModule, ComputedModule, EffectModule } from '@rimitive/signals/extend';import { createDOMAdapter } from '@rimitive/view/adapters/dom';import { createElModule } from '@rimitive/view/el';import { MountModule } from '@rimitive/view/deps/mount';
// 1. Create the adapterconst adapter = createDOMAdapter();
// 2. Compose your serviceconst svc = compose( SignalModule, ComputedModule, EffectModule, createElModule(adapter), MountModule);
// 3. Destructure the primitivesconst { signal, computed, el, mount } = svc;
// 4. Create reactive stateconst count = signal(0);const doubled = computed(() => count() * 2);
// 5. Build the UIconst App = () => el('div')( el('h1')('Counter'), el('p')(computed(() => `Count: ${count()}`)), el('p')(computed(() => `Doubled: ${doubled()}`)), el('button').props({ onclick: () => count(count() + 1) })('Increment') );
// 6. Mount itconst app = mount(App());document.body.appendChild(app.element!);That’s it. Click the button, the count updates, the DOM updates automatically.
What Just Happened?
Section titled “What Just Happened?”compose()wires modules together into a servicesignal()creates reactive state — read withcount(), write withcount(newValue)computed()derives values that update when dependencies changeel()creates DOM elements with reactive children and propsmount()attaches the element tree to the DOM
When count changes, only the parts that depend on it re-render. No virtual DOM diffing, no re-rendering the whole tree.
Next Steps
Section titled “Next Steps”- Composing Signals — Understand the reactive primitives
- Creating a Behavior — Extract reusable logic
- Adding View — Deep dive into
el()and rendering - Dynamic Views — Lists with
map(), conditionals withmatch()