Skip to content

vue/prefer-use-template-ref

require using useTemplateRef instead of ref/shallowRef for template refs

📖 Rule Details

Vue 3.5 introduced a new way of obtaining template refs via the useTemplateRef() API.

This rule enforces using the new useTemplateRef function instead of ref/shallowRef for template refs.

Now loading...

This rule skips ref template function refs as these should be used to allow custom implementation of storing ref. If you prefer useTemplateRef, you have to change the value of the template ref to a string.

Now loading...

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-vue v9.31.0

🔍 Implementation