triggerRef() Force a Shallow Ref Update

Last updated: 2026-10-22

triggerRef() Force a Shallow Ref Update

triggerRef() manually triggers effects linked to a shallow ref — the escape hatch when inner mutations are untracked.

GroupReactivity: Advanced
KindAPI
ScopeComponent
Vue Version3.0+
SSR SupportYes

📝 Syntax

big.value.list.push(1)  // no trigger
triggerRef(big)          // force it

⚙️ Arguments

shallowRefThe shallow ref to force

Returns:None

▶ Example

Edit the code below and see the live result:

Output:

Each click increments the length (without triggerRef it would stay at 1).

💡 Key Points

⚠️ Warning Only needed for shallow refs/reactive; deep refs track automatically.
ℹ️ Note Useful to sync UI after external mutable sources change.
More case studies coming soon.

📚 Related Tutorials

❓ FAQ

Q Can it replace wholesale replacement?
A It works, yet replacing wholesale is clearer and more idiomatic.
Q What happens on a normal ref?
A It still forces an update, usually unnecessary.
Q Does it cause extra renders?
A Yes — it re-runs dependent effects, so avoid calling it in tight loops.
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%

🙏 帮我们做得更好

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

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