another question I had with regards to how Vue works, pardon if it's a silly question. I started from VanillaJS where an element is usually declared as such
<div id="testId" class="testClass">This is some test element</div>
where I then apply the necessary styling and javascript as follows
.testClass {
border: solid red 1px;
}
document.getElementById("testId").onclick = function (){
console.log("clicked");
}
However, after hopping over to VueJS, I can simply (in a good way) replace the above as follows
<template>
<div class="testClass" @click="handleClick">This is some test element</div>
</template>
<script>
export default{
methods: {
handleClick(){
console.log("clicked");
}
}
}
</script>
<style scoped>
.testClass{
border: solid red 1px;
}
</style>
I noticed that I can replicate the entire example without the use of id.
I realized I haven't been using id much, is that bad? and is there any use case that I am missing out?