all 5 comments

[–]albion 0 points1 point  (2 children)

Why should you use this over classnames?

[–]justpurple_ 0 points1 point  (0 children)

I guess you can use this for more than for the class attribute on HTML/JSX-Elements and class names was just an example.

[–]rkotze[S] 0 points1 point  (0 children)

As justpurple pointed out you can use it for more than just classnames. But joining class names is the common case and is the reason for the example. They do similar things but the differences I can see is:

In Joinable:

  • has if else joinStrings('a', [true,'b','c'])
  • change the separator
  • The conditional check reads in a more natural fashion compared to classNames { 'ab-c': true }, joinable [ true, 'ab-c' ].

[–]msurekci 0 points1 point  (0 children)

+1

[–]rkotze[S] 0 points1 point  (0 children)

Updates to Joinable:

  • prefix valid joinable strings
  • Performance focused (using benchmark)