Vue: getting started

Lesson 02 · 11 min

ref, bindings, events

Reactivity isn't "magic". Change `.value` on a ref and the template redraws itself.

ref(0) wraps a value. In the script you read and write count.value. In the template you don't need .value: {{ count }}. For an object people often use reactive({ n: 0 }) — the fields are reactive right away, without .value. Don't mix them without a reason.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.