question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mitosis refs do not work when you compile to Vue

See original GitHub issue

I tried to run your “Methods and Refs” example code on playground the link and compiled it to Vue. The problem is that refs in Vue don’t have ".current" 😃 but if I change to be just inputRef.focus(); it works the link.

I first discovered that when I was using cli, but I see the same issue on the playground 😃

you can also see it here https://youtu.be/mitz2leHqoE?t=4284 at about 1:11:24

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
sahilmobcommented, Mar 3, 2022

If that’s the case, we should consider adding an eslint rule for it.

0reactions
tomByrercommented, Mar 18, 2022

I think I need to use refs for Web Animation API, since the plain HTML usage is via element method?

https://developer.mozilla.org/en-US/docs/Web/API/Element/animate#examples

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template Refs in v-for not working · Issue #5525 · vuejs/core
Open the DevTools and look at the console.logs from onMounted . You now see three logs, each representing a different template Ref. Log...
Read more >
Why does the vue documentation say refs are not reactive ...
When data is reactive, it means that changes to the value of that data will trigger a "reaction" from some part of the...
Read more >
[SOLVED] This.$refs.key returns undefined when it really is
According to what you said. We cannot get $refs in created is because render function is not yet compiled. And refer to the...
Read more >
Vue 3 Composition API: How to Omit `.value` in refs
In this article, we discuss how to omit .value in VueJS refs, creating APIs by converting them into reactive variables using macros.
Read more >
How Mitosis compiles components to any framework - YouTube
Write components once, run everywhere. Mitosis can compile to Vue, React, Solid, Angular, Svelte, Qwik, React Native, and moreLearn how it ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found