import { router } from '@kit.ArkUI' // Keywords such as struct and @State stay in the comment scope. @Entry @Component struct Index { @State message: string = 'Hello ArkTS' private items: Array = ['One', 'Two'] @Builder title(text: string) { Text(text) .fontSize(24) } build() { Column({ space: 12 }) { this.title(this.message) Row() { Text(`${this.message}: ${this.items.length}`) .fontColor(Color.Blue) Button('Change') .onClick(() => { this.message = 'Updated' }) } ForEach(this.items, (item: string) => { Text(item) }, (item: string) => item) } .width('100%') .height('100%') } } @ObservedV2 class Counter { @Trace count: number = 0 } @ComponentV2 struct CounterView { @Local counter: Counter = new Counter() @Param label: string = 'Count' build() { Text(`${this.label}: ${this.counter.count}`) } }