/// import { Cell, Default, handler, NAME, recipe, str, UI } from "commontools"; interface CounterState { value: Cell; } interface RecipeState { value: Default; } const increment = handler((_e, state) => { state.value.set(state.value.get() + 1); }); const decrement = handler((_, state: { value: Cell }) => { state.value.set(state.value.get() - 1); }); export default recipe("Counter", (state) => { return { [NAME]: str`Simple counter: ${state.value}`, [UI]: (
-
  • next number: {state.value ? state.value + 1 : "unknown"}
+
), value: state.value, }; });