switch·Esc back

Vue

You might say

Is Vue really friendlier for beginners, and how is it different from React?

A JavaScript framework for building interactive interfaces with templates and componentsWhen a +1 button changes a count from 0 to 1, Vue updates the bound text on the page. It controls how the interface reflects data; a server still handles durable storage.
Know first
Vue.js
Why does the button text follow `count`?
Counter.vue
1const count = ref(0)
2<button @click="count++">
3 Added {{ count }} item(s)
4</button>
localhost:3000
Canvas tote¥ 79
count.value in the ref is now 0

The template keeps reading this value. When the ref changes, its text updates too.

How a ref updates template text

A ref holds the valueA ref can remember whether count is 0 or 1.

The template reads it{{ count }} means show the current value of count here.

A change updates the viewWhen a click changes the ref, Vue updates the template locations that read it.

Learn next
Further reading