/// import { recipe, UI } from "commontools"; interface Item { id: number; name: string; } interface State { items: Item[]; } export default recipe("IndexShorthand", (state) => { return { [UI]: (
{/* Map with common shorthand index parameter names */} {state.items.map((item, i) => (
Item #{i}: {item.name}
))} {/* Map with idx as index parameter */} {state.items.map((item, idx) => (
Position {idx}: {item.name}
))}
), }; });