How to fix the unknown custom element error with Vue.js?

Sometimes, we want to fix the unknown custom element error with Vue.js.

In this article, we’ll look at how to fix the unknown custom element error with Vue.js.

How to fix the unknown custom element error with Vue.js?

To fix the unknown custom element error with Vue.js, we need to register the components we use in our component.

For instance, we write

<template>
  <my-task></my-task>
</template>

<script>
//...

export default {
  //...
  components: {
    MyTask,
  },
  //...
};
</script>

to register the MyTask component with

components: {
  MyTask,
},

Then we can use the MyTask component with

<my-task></my-task>

Conclusion

To fix the unknown custom element error with Vue.js, we need to register the components we use in our component.