Categories
Vue Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *