Concepts
Model, Message, Update, View
Keep state explicit and make every interaction a typed transition.
The Model is the durable state owned by the application. Messages are the closed set of events the application handles. An update returns the next Model, optionally with Commands; it does not return the Model directly. The View is a pure projection of that Model into UI. This makes transitions reviewable and testable without a browser.
import type * as Update from '@wsagency/wseffect-foldkit/update'
type Model = { readonly count: number }
type Message = { readonly _tag: 'Increment' }
const update = (model: Model, message: Message): Update.Return<Model, Message> =>
message._tag === 'Increment'
? { model: { count: model.count + 1 } }
: { model }
Views receive messages from event handlers; they should not mutate the Model directly. Keep ephemeral DOM details out of application state unless they affect behavior.