Sean's Blog
avatar
路漫漫其修远兮。

Buggy Vue 2.7 JSX

21st October 2024 Last updated:14th April 2026 1 Minutes · 131 Words

While maintaining a legacy project I recently introduced Vue 2.7 and the official JSX plugin jsx-vue2. Things were going fine until I started hitting one pitfall after another…

1. vModel throws an error with the official Vue 2 JSX plugin

vModel: __currentInstance.$set is not a function

Related issues:

Workaround:

Drop the vModel shorthand and fall back to value + onInput manually.

2. Cannot get a component ref

Related issue:

Workaround:

Assign the ref manually using a function:

1
const customRef = ref()
2
3
<SwitchSettingCommonModal ref={el => { customRef.value = el } />

Looking forward to the next pitfall 🥹.


Since Vue 2 has reached EOL and is no longer maintained officially, I would not recommend continuing to use Vue 2 or its JSX plugin. If you still have active development needs, migrate to Vue 3 — it is still maintained and bugs will be fixed.

Article title:Buggy Vue 2.7 JSX
Article author:Suyi
Release time:21st October 2024