/// import { recipe, UI } from "commontools"; interface State { items: string[]; index: number; matrix: number[][]; row: number; col: number; } export default recipe("ElementAccessSimple", (state) => { return { [UI]: (

Dynamic Element Access

{/* Basic dynamic index */}

Item: {state.items[state.index]}

{/* Computed index */}

Last: {state.items[state.items.length - 1]}

{/* Double indexing */}

Matrix: {state.matrix[state.row]![state.col]}

), }; });