JaiDécouvert lalibrary classix un équivalent à clsx mais :

String expressions have a few benefits over objects:

  • A faster typing experience
  • A more intuitive syntax (conditions first)
  • else support through ternary operators

What’s more, by leveraging them, classix provides:

  • A simpler and consistent API
  • A smaller library size
  • Better performance

from

Après avoir vu cela, j’ai creusé un peu le sujet etJaiDécouvert que clsx a sorti une nouvelle release après la création de classix : https://github.com/lukeed/clsx/releases/tag/v2.1.0

Add new clsx/lite submodule for string-only usage: 1a49142

This is a 140b version of clsx that is ideal for Tailwind and/or React contexts, which typically follow this clsx usage pattern.

clsx('foo bar', props.maybe && 'conditional classes', props.className);

Qui, d’après ce que je comprends, reprend en partie l’implémentation de classix.

Afin d’éviter un effet de balkanisation, je vais utiliser clsx.


Tous les tags présents dans la note :