v-memo Memoize Subtree Rendering

Last updated: 2026-10-22

v-memo Memoize Subtree Rendering

v-memo takes a dependency array; when unchanged the whole subtree is skipped — a performance tool for very long lists (Vue 3.2+).

GroupDirectives
KindDirective
ScopeTemplate
Vue Version3.2+
SSR SupportYes

📝 Syntax

<div v-memo="[valueA, valueB]">...</div>

<li v-for="item in list" :key="item.id" v-memo="[item.selected]">

⚙️ Arguments

expressionAn array of dependencies; identical values skip the update (an empty array equals v-once)

Returns:Directive, no return value

▶ Example

Edit the code below and see the live result:

Output:

The number only updates when the dependency changes — a demo of skipping updates in long lists.

💡 Key Points

⚠️ Warning Use only when profiling shows a bottleneck: a missed dependency means stale UI.
ℹ️ Note Its main use is with v-for: v-memo="[item.selected]" skips diffing unselected rows.
💡 Tip v-memo="[]" behaves like v-once (never re-renders).
More case studies coming soon.

📚 Related Tutorials

❓ FAQ

Q When should I use v-memo?
A When long lists with heavy static content visibly lag — profile first, then apply.
Q What happens if dependencies are wrong?
A A missing dependency means stale UI; extra dependencies merely lose the benefit.
Q How does it relate to v-once?
A v-memo="[]" equals v-once; normally it is a conditional skip.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏