Vue's v-once: Render Once, Then Ignore
Use `v-once` to render a part of your template exactly once. After the initial render, Vue treats it as static content, ignoring future data updates for that element and its children. This is a performance optimization for content that never needs to change.
The `v-once` directive is Vue's 'set it and forget it' switch. It renders an element and its children one time based on initial data. Afterwards, Vue skips all future updates for this part of the DOM, treating it as a static island. Use it to optimize performance on content you know is static, like a user's sign-up date. The main footgun is accidentally disabling reactivity for child components by placing `v-once` on a parent element when a child needs to update.
Read the original → vuejs.org
- #vue
- #performance
- #directives
- #frontend
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.