Vue, use a component inside another component

Here's how to import a component inside another component in Vue.js

Say you have a Pixel component in src/components/Pixel.vue

In another component, Canvas, which is located in src/components/Canvas.vue, you can import that Pixel component by importing it inside the script tag of the Vue Single File Component:

  <Pixel />

import Pixel from './Pixel'

export default {
  name: 'App',
  components: {

Download my free Vue Handbook and check out my courses!

⭐️ Join the waiting list for the JavaScript Masterclass ⭐️