Vue offers several lifecycle hooks that allow you to run code when a particular component enters (or exists) a predetermined state.

One of them is mounted.

It is called when the component is added to the view.

It’s a very important hook and one that we’ll use in the example app.

<script>
export default {
  data() {
    return {
      hello: 'Hello World!'
    }
  },
  mounted() {
    //...
  }
}
</script>