Composables
Sprig has no special composable API. A composable can be an ordinary JavaScript function that creates or accepts signals, returns derived getters and actions, and registers cleanup while called inside an owning root/effect:
js
import { onCleanup, signal } from 'sprig-framework';
export function useClock() {
const [now, setNow] = signal(Date.now());
const timer = setInterval(() => setNow(Date.now()), 1000);
onCleanup(() => clearInterval(timer));
return { now };
}Call cleanup-registering helpers inside a Sprig-owned scope. This is a coding pattern, not a framework-enforced naming convention.