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).

#ExampleExercises
1Countersignal + mount
2Computed totalssignal + chained computed
3StoredefineStore + named actions, reset()
4Mount + delegatedelegate + data-action
5Keyed listeach + focus survival
6Capture-phase delegatedelegateCapture
7data-morph-skippreserving library-owned subtrees
8JSX SVG via toElementSVG namespace + interactive shape
9raw() + sanitisationinjecting safe HTML