Need to convert js to vuejs

Viewed 26
<script type="text/javascript">
        const btn = document.querySelector("#btn");
        const btnText = document.querySelector("#btnText");

        btn.onclick = () => {
            btnText.innerHTML = "Thanks";
            btn.classList.add("active");
        };
    </script>

I tried to change this content to vuejs 3. But iam unable to do and getting some error. Don't know how to convert this to Vue js

1 Answers
<template>
  <button :class="{ active: clicked }" :onclick="clicked = true">
    {{ clicked ? 'Thanks!' : 'Click me!' }}
  </button>
</template>

<script setup>
import {ref} from 'vue'
const clicked = ref(false)
</script>
Related