1# ArkUI Subsystem Changelog 2 3### Restrictions on Using Decorators 4 5#### 1. Restrictions on Using Component Decorators 6 7Component decorators @Component, @Entry, @Preview, and @CustomDialog apply only to structs, not classes. 8 9**Example** 10 11``` 12@Component 13 // ERROR:The '@Component' decorator can only be used with 'struct'. 14class Index { 15 build() { 16 } 17} 18``` 19 20**Change Impact** 21 22If @Component, @Entry, @Preview, or @CustomDialog is used to decorate components other than structs, a compile time error will occur. 23 24**Key API/Component Changes** 25 26N/A 27 28**Adaptation Guide** 29 30Use @Component, @Entry, @Preview, and @CustomDialog to decorate only structs. 31 32#### 2. Restrictions on Using Component Member Variable Decorators 33 34Component member variable decorators @State, @Prop, @Link, @Provide, @Consume, @ObjectLink, @StorageLink, @StorageProp, @LocalStorageLink, @LocalStorageProp, @Watch, and @BuilderParam can decorate only the member variables of structs. 35 36**Example** 37 38``` 39@Component 40class Index { 41 // ERROR: The '@State' decorator can only be used with 'struct'. 42 @State message: string = 'Hello world' 43 44 build() { 45 46 } 47} 48``` 49 50**Change Impact** 51 52If any of the aforementioned component member variable decorators is used to decorate a member variable of components other than structs, a compile time error will occur. 53 54**Key API/Component Changes** 55 56N/A 57 58**Adaptation Guide** 59 60Use the aforementioned component member variable decorators to decorate only the member variables of structs. 61