Skip to content

Basic examples

Nine examples, one core principle each. Read them in order or jump straight to the API you want to see.

Every snippet is complete and copy-pasteable into a Vite project with kerfjs installed and tsconfig.json configured for "jsxImportSource": "kerfjs" (see Install).

# Example Exercises
1 Counter signal + mount
2 Computed totals signal + chained computed
3 Store defineStore + named actions, reset()
4 Mount + delegate delegate + data-action
5 Keyed list each + focus survival
6 Capture-phase delegate delegateCapture
7 data-morph-skip preserving library-owned subtrees
8 JSX SVG via toElement SVG namespace + interactive shape
9 raw() + sanitization injecting safe HTML