[Vuejs]-Structure: Where put navigation bar component (Vue/ React)

0👍

Hello you can call components from anywhere, you just need to create the component in a separate file in your components folder. (mycomponent.vue)

<template>
<h1>I am a component</h1>
</template>

and then in your view you need to import that component with:

import mycomponent from './mycomponent.vue'

and finally you just need to declare it inside your instance like this.

export default {
  components: {
    mycomponent
  },
  // ...
}

if you do this you are going to be able to print that h1 using in your view this tag.

<mycomponent></mycomponent>

it’s like if you create your own html tag.

it’s very simple, greetings, hope it helps just do it with your nav bar no with an h1.

Leave a comment