lukeed / clsx

A tiny (239B) utility for constructing `className` strings conditionally.
MIT License
8.28k stars 143 forks source link

Add comparison with Classnames utility #35

Closed ghost closed 3 years ago

ghost commented 3 years ago

https://github.com/JedWatson/classnames

There's a well established library which seems to do what this library does, is older and has more installations. To the casual observer it's not clear what's different between this library and that library. I've already seen people adding clsx to apps when classnames is already present probably because they (1) didn't know the prior exists and (2) like the terse syntax.

Please update your README to provide a comparison of the two tools and link to the other one and send them an issue to backlink to you. Otherwise we're looking at another husky situation down the line due to devs not realizing what this library is and isn't. Thanks.

ghost commented 3 years ago

Here's one thing this library appears to have going for it:

Screen Shot 2021-04-21 at 8 42 26 PM

When I tried a yarn add --dev @types/classnames the above issue persisted with the other library, causing me to have to throw out a declare module 'classnames'; in a d.ts file in my app.

lukeed commented 3 years ago

Also serves as a faster & smaller drop-in replacement for the classnames module.

^second sentence of the readme. That's all there is to know. Sure, included TypeScript definitions is a bonus, but isn't a reason to pick one over the other.

ghost commented 3 years ago

LMAO. Sorry dude totally missed that. >_^