Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

Vue.js v-once Directive

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The v-once directive is a Vue.js directive that is used to avoid unwanted re-renders of an element. It treats the element as a static content after rendering it once for the first time. This improves performance as it does not have to be rendered again. First, we will create a div element with the id of choice. The v-once directive is then applied to this element to make it render only once.



Parameters: This function does not accept any parameter.

Example: This example uses Vue.js to show the working of the data with v-once.

<!DOCTYPE html>
        VueJS v-once Directive
    <!-- Load Vuejs -->
    <script src=
    <div style="text-align: center;
              width: 600px;">
        <h1 style="color: green;">
            VueJS | v-once directive
    <div id="canvas" style=
        "border: 1px solid #000000;
        width: 600px; height: 200px;">
        <div id="app" style="text-align: center;
                padding-top: 40px;">
            <h1 v-once>{{ data }}</h1>
        var app = new Vue({
            el: '#app',
            data: {
                data: 'GeeksforGeeks'


My Personal Notes arrow_drop_up
Last Updated : 14 Jul, 2020
Like Article
Save Article
Similar Reads
Related Tutorials