Javascript is required
Mokkapps Logo

Vue Tip: Avoid Empty Class Attributes

Michael Hoffmann (Mokkapps) - Senior Frontend Developer (Freelancer)
Nov 14, 2021
1 min read
|
89 views
Style
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 content from me. Alternatively (or additionally), you can also subscribe to my newsletter.