Q1. When should you use v-if instead of v-show?
v-if conditionally renders: when the expression is falsy the element and its children are not created, and they are destroyed when it flips. It supports v-else and v-else...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (23 available).
v-if conditionally renders: when the expression is falsy the element and its children are not created, and they are destroyed when it flips. It supports v-else and v-else...
VueJS provides set of directives to show or hide elements based on conditions. The available directives are: **v-if, v-else, v-else-if and v-show** **1. v-if:** The v-if ...
Below are some of the main differences between **v-show** and **v-if** directives, 1. v-if only renders the element to the DOM if the expression passes whereas v-show ren...
The built-in v-for directive allows us to loop through items in an array or object. You can iterate on each element in the array or object. 1. **Array usage:** ```javascr...
It is recommended not to use v-if on the same element as v-for. Because v-if directive has a higher priority than v-for. There are two cases where developers try to use t...
In order to track each node's identity, and thus reuse and reorder existing elements, you need to provide a unique `key` attribute for each item with in `v-for` iteration...
You can also use integer type(say 'n') for `v-for` directive which repeats the element many times. ```javascript {{ n }} ``` It displays the number 1 to 20. ****
Just similar to v-if directive on template, you can also use a `` tag with v-for directive to render a block of multiple elements. Let's take a todo example, ```javascrip...
The v-model directive on a component uses **value** as the prop and **input** as the event, but some input types such as `checkboxes` and `radio buttons` may need to use ...
Custom Directives are tiny commands that you can attach to DOM elements. They are prefixed with v- to let the library know you're using a special bit of markup and to kee...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.