![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
The fastest and tiniest utility for conditionally joining classNames.
npm install classix
Use any amount of string expressions and classix will join them like so:
import cx from "classix";
// or
import { cx } from "classix";
cx("class1", "class2");
// => "class1 class2"
cx("class1 class2", "class3", "class4 class5");
// => "class1 class2 class3 class4 class5"
cx("class1", true && "class2");
// => "class1 class2"
cx(false && "class1", "class2");
// => "class2"
cx(true ? "class1" : "class2");
// => "class1"
cx("class1", false ? "class2" : "class3");
// => "class1 class3"
cx(...["class1", "class2", "class3"]);
// => class1 class2 class3
cx(
"flex",
isPrimary ? "bg-primary-100" : "bg-secondary-100",
isLarge ? "m-4 p-4" : "m-2 p-2",
);
// => "flex bg-primary-100 m-2 p-2" *assuming isPrimary is true and isLarge is false
Compared to other libraries, classix only allows string expressions as arguments:
// 🚫
clsx({ "class-1": isPrimary });
// ✅
cx(isPrimary && "class-1");
// 🚫
clsx({ "class-1": isPrimary && isLarge, "class-2": !isPrimary || !isLarge });
// ✅
cx(isPrimary && isLarge ? "class-1" : "class-2");
String expressions have a few benefits over objects:
else
support through ternary operatorsWhat's more, by leveraging them, classix provides:
Sources: classix, clsx, classnames
Sources: Ran benchmark on an AMD Ryzen 5 5600x with Node 20.
If you are using classnames
or clsx
, you can migrate to classix
by changing your imports
:
- import classnames from 'classnames';
+ import cx from 'classix';
And if you were using object arguments, you'll have to convert them to string arguments:
- classnames({ 'class-1': cond1, 'class-2': cond2 });
+ cx(cond1 && 'class-1', cond2 && 'class-2')
That's it!
"This looks great. I agree that the object notation is not great and not worth the perf hit." — @jmeistrich
"It looks good! I like the idea that you can’t pass objects and is simple and minimal. I will use it on my next application instead of classnames." — @m0ment98
"Thank you for creating and maintaining this package! It is great." — @charkour
For a list of changes and releases, see the changelog.
Found a bug, have a question or looking to improve classix? Open an issue, start a discussion or submit a PR!
FAQs
The fastest and tiniest utility for conditionally joining classNames.
The npm package classix receives a total of 2,638 weekly downloads. As such, classix popularity was classified as popular.
We found that classix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.