Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Advanced Components: Exposing Internal State

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

What is v-model doing in this course?

The v-model directive in Vue.js is not intended for directly exposing state, but rather for synchronizing a "model" with form elements or components.

In this lesson, we will use the example of a Menu as a Select to make the comparison more apparent.

We will also highlight the fact, that sometimes, what we need is a v-model, rather than exposing some state and its handlers. It requires a bit more effort to implement, but will often be easier to understand and more fitting for the component’s consumers.

The goal of this lesson is to help you understand when exposing state might not be necessary and v-model would be a better solution