/// import { recipe, UI } from "commontools"; interface Item { id: number; price: number; } interface State { items: Item[]; discount: number; threshold: number; } export default recipe("ConditionalExpression", (state) => { return { [UI]: ( {/* Ternary with captures in map callback */} {state.items.map((item) => ( Price: ${item.price > state.threshold ? item.price * (1 - state.discount) : item.price} ))} ), }; });