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 6\@ComponentV2 is used together with state management V2. Before reading this topic, you are advised to read [State Management Overview](./arkts-state-management-overview.md). 7 8>**NOTE** 9> 10>The \@ComponentV2 decorator is supported since API version 12. 11> 12 13 14## Overview 15 16Similar to [\@Component Decorator](arkts-create-custom-components.md), the \@ComponentV2 decorator is used to decorate custom components. 17 18- In the custom component decorated by \@ComponentV2, only new state variable decorators can be used, including \@Local, \@Param, \@Once, \@Event, \@Provider, and \@Consumer. 19- Custom components decorated by \@ComponentV2 do not support component reuse and LocalStorage. 20- \@ComponentV2 and \@Component cannot be used to decorate the same struct. 21- \@ComponentV2 can use an optional parameter **freezeWhenInactive** of the **boolean** type to implement the [component freezing](arkts-custom-components-freezeV2.md). 22 23- A simple \@ComponentV2 decorated custom component should contain the following parts: 24 25 ```ts 26 @ComponentV2 // Decorator 27 struct Index { // Data declared by the struct 28 build() { // UI defined by build 29 } 30 } 31 ``` 32 33Unless otherwise specified, a custom component decorated by \@ComponentV2 maintains the same behavior as a custom component decorated by \@Component. 34 35## Constraints 36 37For 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). 38