1e41f4b71Sopenharmony_ci# !! Syntax: Two-Way Binding
2e41f4b71Sopenharmony_ciIn state management V1, [$$](./arkts-two-way-sync.md) is used for two-way binding of built-in components.
3e41f4b71Sopenharmony_ciIn state management V2, the **!!** syntactic sugar is used to implement two-way binding of components in a unified manner.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci>**NOTE**
7e41f4b71Sopenharmony_ci>
8e41f4b71Sopenharmony_ci>The **!!** syntax is supported since API version 12.
9e41f4b71Sopenharmony_ci>
10e41f4b71Sopenharmony_ci>State management V2 is still under development, and some features may be incomplete or not always work as expected.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## Overview
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**!!** is a syntactic sugar used to implement two-way binding of components in initialization of \@Param and \@Event of the child components. The \@Event method name must be declared as "$" + \@Param attribute name. For details, see [Use Scenarios](#use-scenarios).
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci- If the parent component uses **!!**, the change of the parent component will be synchronized to the child component, and vice versa.
17e41f4b71Sopenharmony_ci- If the parent component does not use **!!**, the change of the parent component is unidirectional.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci## Constraints
21e41f4b71Sopenharmony_ci**!!** does not support multi-layer parent-child component transfer.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci## Use Scenarios
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci### Two-Way Binding Between Custom Components
27e41f4b71Sopenharmony_ci1. Construct the **Star** child component in the **Index** component, bind the value in the parent and child components bidirectionally, and initialize **@Param value** and **@Event $value** of the child component.
28e41f4b71Sopenharmony_ci- The two-way binding syntactic sugar can be considered as:
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci    ```
31e41f4b71Sopenharmony_ci    Star({ value: this.value, $value: (val: number) => { this.value = val }})
32e41f4b71Sopenharmony_ci    ```
33e41f4b71Sopenharmony_ci2. Click the button in the **Index** component to change the value, and **Text** in both the parent component **Index** and child component **Star** will be updated.
34e41f4b71Sopenharmony_ci3. Click the button in the child component **Star** to invoke **this.$value(10)**, and **Text** in both the parent component **Index** and child component **Star** will be updated.
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci```ts
37e41f4b71Sopenharmony_ci@Entry
38e41f4b71Sopenharmony_ci@ComponentV2
39e41f4b71Sopenharmony_cistruct Index {
40e41f4b71Sopenharmony_ci  @Local value: number = 0;
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci  build() {
43e41f4b71Sopenharmony_ci    Column() {
44e41f4b71Sopenharmony_ci      Text(`${this.value}`)
45e41f4b71Sopenharmony_ci      Button(`change value`).onClick(() => {
46e41f4b71Sopenharmony_ci        this.value++;
47e41f4b71Sopenharmony_ci      })
48e41f4b71Sopenharmony_ci      Star({ value: this.value!! })
49e41f4b71Sopenharmony_ci    }
50e41f4b71Sopenharmony_ci  }
51e41f4b71Sopenharmony_ci}
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci@ComponentV2
55e41f4b71Sopenharmony_cistruct Star {
56e41f4b71Sopenharmony_ci  @Param value: number = 0;
57e41f4b71Sopenharmony_ci  @Event $value: (val: number) => void = (val: number) => {};
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci  build() {
60e41f4b71Sopenharmony_ci    Column() {
61e41f4b71Sopenharmony_ci      Text(`${this.value}`)
62e41f4b71Sopenharmony_ci      Button(`change value `).onClick(() => {
63e41f4b71Sopenharmony_ci        this.$value(10);
64e41f4b71Sopenharmony_ci      })
65e41f4b71Sopenharmony_ci    }
66e41f4b71Sopenharmony_ci  }
67e41f4b71Sopenharmony_ci}
68e41f4b71Sopenharmony_ci```
69