79484435

Date: 2025-03-04 17:34:34
Score: 1
Natty:
Report link

The original statement is correct: useTemplateRef is not reactive for arrays, as of Vue 3.5, but this may change in a future version.

See this helpful discussion with a Vue team member about the topic: https://github.com/orgs/vuejs/discussions/12989

It seems like this was a design mistake that they intend to correct.


Not trying to be pedantic here, but @tao's answer is not quite right, and I want to clarify because it could confuse someone.

itemRefs is updated (e.g reactive). But it's always updated 1 render cycle after list has changed. Wrap your console.log in nextTick (imported from 'vue') and the numbers will match:

itemRefs is not reactive. Indeed, itemRefs will have the expected value after a nextTick. But the "show code snippet" example works because you are watching the list source (which is truly reactive) and it ultimately determines how many itemRefs there will be. But if you were to just watch itemRefs as the source, it would not work.

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @tao's
Posted by: V. Rubinetti