re: You do not need to use the classnames package VIEW POST


Agreed, I think classNames is a bit of overkill for what is essentially concatenation of strings. However template literals can get hectic and hard to reason about very quickly. What I normally do is:

const componentClassName = [
  someBooleanCondition && 'a-class-in-here',
  someOtherBoolean && 'another-class',
  .join(' ')

Written on a mobile so forgive any typos!

code of conduct - report abuse