Skip to content

Commit 281515b

Browse files
feat: added lesson 1 description
1 parent b2461e3 commit 281515b

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/tutorial/src/step-1/description.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,33 @@
22

33
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
44

5-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
5+
How to make it dynamic? We need to create our first _reactive_ property `colorsNumber`
6+
7+
<div class="options-api">
8+
9+
```js
10+
data() {
11+
return {
12+
colorsNumber: 3
13+
}
14+
}
15+
```
16+
17+
</div>
18+
19+
<div class="composition-api">
20+
21+
```js
22+
import { ref } from 'vue'
23+
const colorsNumber = ref(3)
24+
```
25+
26+
</div>
27+
28+
Now, we can use it in our template instead of a static number:
29+
30+
```html
31+
<h2>Number of colors: {{ colorsNumber }}</h2>
32+
```
33+
34+
Try to change the `colorsNumber` and check how it immediately updates the rendered HTML.

0 commit comments

Comments
 (0)