App Initialization
Learn the differences between Vue 2 and Vue 3 concerning Vue application initialization.
We'll cover the following...
Another change in the latest version of Vue is how a Vue application is initialized. Previously, new Vue() was used to create a new Vue application instance. However, it was impossible to create separate Vue applications in Vue 2 because they shared the same Vue context. Vue 3 doesn’t have a default export anymore, so a Vue application must be created using the createApp method. The createApp returns a new application instance, which provides an isolated Vue context.
Note: References to Vue applications in this section, it doesn’t mean two separate Vue projects but, rather, one project with two Vue application instances that were created using the
createAppmethod.
Vue 2 and Vue 3
See how the ...