For simple use cases classnames is definitely an overkill, but I would say if you have more than 2 conditions in the same template literal it becomes ugly really quickly.
Also there is a smaller package for the same purpose called clsx.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
this should return 'foo-bar' instead of ''.
For simple use cases
classnames
is definitely an overkill, but I would say if you have more than 2 conditions in the same template literal it becomes ugly really quickly.Also there is a smaller package for the same purpose called
clsx
.Thanks, correction made. Yes, agreed that it could get unwieldy, just showing another way of doing things is all. 😉