/// import { recipe, UI } from "commontools"; interface Item { id: number; name: string; } interface State { items: Item[]; prefix: string; suffix: string; } export default recipe("TemplateLiteral", (state) => { return { [UI]: (
{/* Template literal with captures */} {state.items.map((item) => (
{`${state.prefix} ${item.name} ${state.suffix}`}
))}
), }; });