Skip to content

Optimize performance directive medium #Directives #Built-ins

By webfansplz @webfansplz

Take the Challenge    简体中文

Vue.js provides a directive that renders the element and the component only once, and skips future updates.

Do you know what the directive is?. Lets try it 👇:

<script setup>
import { ref } from "vue"

const count = ref(0)

setInterval(() => {
  count.value++
}, 1000)
</script>

<template>
  <span>Make it not to change: {{ count }}</span>
</template>

Share your Solutions Check out Solutions