Javascript is required
Mokkapps LogoMichael Hoffmann

Vue Tip: Avoid Empty Class Attributes

Michael Hoffmann (Mokkapps) - Senior Frontend Developer (Freelancer)
Michael Hoffmann
Nov 14, 2021
1 min read
|
117 views
Style
Vue Tip: Avoid Empty Class Attributes Image
Good
<template>  <div :class="isDisabled ? 'disabled' : null"></div>  <!-- Will render <div></div> --></template>
Bad
<template>  <div :class="isDisabled ? 'disabled' : ''"></div>  <!-- Will render <div class></div> --></template>

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