/// import { recipe, UI, handler, Cell } from "commontools"; declare global { namespace JSX { interface IntrinsicElements { "ct-button": any; } } } // Event handler defined at module scope const handleClick = handler }>((_, { count }) => { count.set(count.get() + 1); }); interface Item { id: number; name: string; } interface State { items: Item[]; count: Cell; } export default recipe((state) => { return { [UI]: (
{/* Map callback references handler - should NOT capture it */} {state.items.map((item) => ( {item.name} ))}
), }; });