Skip to content
Advertisement

Vue 3 refs is undefined in render function

I have a simple Vue component with root element as ref="divRef". However, in onMounted function, divRef.value returns undefined. Any help will be appreciated.

JavaScript

Advertisement

Answer

In your render function, pass the divRef itself, not a string:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement