Application Instance
Every Vue 3 application starts by creating a new application instance using the createApp
function. An options object is passed to the createApp
function to configure the root component. We will discuss what options can be included in this object later in the course.
const app = Vue.createApp({ /* options */ })
An application needs to be mounted to a DOM element using the mount
function. The mount
will provide access to the root component.
<body>
<div id="app"></div>
</body>
const app = Vue.createApp({ /* options */ })
const vm = app.mount('#app')
NOTE
The createApp
function and the application instance are new to Vue 3 and will not work in previous versions of Vue. Likewise, creating a Vue Instance, a common practice in Vue 2, does not work in Vue 3.