1# \@ComponentV2 Decorator: Custom Component 2 3To use the capability of the state variable decorator V2 in a custom component, you can use the \@ComponentV2 Decorator to decorate the custom component. 4 5>**NOTE** 6> 7>The \@ComponentV2 decorator is supported since API version 12. 8> 9 10 11## Overview 12 13Similar to [\@Component Decorator](arkts-create-custom-components.md), the \@ComponentV2 decorator is used to decorate custom components. 14 15- In the custom component decorated by \@ComponentV2, only new state variable decorators can be used, including \@Local, \@Param, \@Once, \@Event, \@Provider, and \@Consumer. 16- Custom components decorated by \@ComponentV2 do not support component reuse and LocalStorage. 17- \@ComponentV2 and \@Component cannot be used to decorate the same struct. 18- \@ComponentV2 can use an optional parameter **freezeWhenInactive** of the **boolean** type to implement the [component freezing](arkts-custom-components-freezeV2.md). 19 20- A simple \@ComponentV2 decorated custom component should contain the following parts: 21 22 ```ts 23 @ComponentV2 // Decorator 24 struct Index { // Data declared by the struct 25 build() { // UI defined by build 26 } 27 } 28 ``` 29 30Unless otherwise specified, a custom component decorated by \@ComponentV2 maintains the same behavior as a custom component decorated by \@Component. 31 32## Constraints 33 34For details about how to use the custom components decorated by \@Component and \@ComponentV2 together, see [Mixing Use of Custom Components](./arkts-custom-component-mixed-scenarios.md). 35