Javascript is required
·
0 min read

Vue Tip: Avoid Empty Class Attributes

Vue Tip: Avoid Empty Class Attributes Image
1<template>
2  <div :class="isDisabled ? 'disabled' : null"></div>
3  <!-- Will render <div></div> -->
4</template>
1<template>
2  <div :class="isDisabled ? 'disabled' : ''"></div>
3  <!-- Will render <div class></div> -->
4</template>

If you liked this Vue tip, follow me on X to get notified about new tips, blog posts, and more. Alternatively (or additionally), you can subscribe to my weekly Vue & Nuxt newsletter:

I will never share any of your personal data. You can unsubscribe at any time.