5 Vue Interview Questions You should Know

tutspack laravel
Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Hello Developers,

How are you doing? Are you preparing for Vue Interview Questions? In this tutorial, I will discuss with you 5 Vue interview questions that will help you. So here we go.

1 . What is a Vue instance?

The Vue instance often referred to as vm in a Vue application is the ViewModel of the MVVM pattern that Vue follows. The Vue instance is the root of a Vue application.

new Vue({
  render: h => h(App),
}).$mount(‘#app’)

2. What are the differences between v-if and v-show?

v-if will not render the element in the DOM if the expression evaluates to false. In the case of v-show, it will render the element in the DOM no matter what, but will be hidden if falsev-if supports v-else and v-else-if and can be used inside the <template> element, v-show does not support this.

3.  What are Vue components?

Vue components are reusable Vue instances that have a name. They support the same properties as the root Vue instance such as data, methods, computed, watch, mixins, as well as the lifecycle methods (small variations to how it’s written in a component). Below is an example of a Vue component.

<template>
  <div>
    <p>{{ name }}</p>
  </div>
</template>
<script>
export default {

}
</script>
<style scoped>
p {
  padding: 10px;
  font-size: 30px;
}

4. What are props?

Props are custom attributes that you can register to a component. When passed from another component or the root Vue instance, the prop becomes a property of the component you passed it to. You can specify multiple props and define their type as well.

5. What are mixins?

Mixins are a flexible way that enable function distribution among components. A mixin can contains any option found in a component. When a component references one or more mixins, the options of the mixin will be “mixed” into the component.

In the case of data conflicts, the component’s data property will take precedence. The same goes for methods, components, directives. As for lifecycle hooks of the same name, both will be merged into an array in which the mixin hook will be called before the component hook.

Read More : How to use Mixins in Nuxt.JS with Example


Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  

About Anisur Rahman Shahin

Hello. My name is Shahin. I'm a tech enthusiast guy. Personally, I’m Optimistic and always in hurry kinda person. I'm a freelance web developer. I am working at Zakir Soft as Laravel Developer. My Portfolio website: https://devshahin.com/

View all posts by Anisur Rahman Shahin →

Leave a Reply

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