Last active
January 17, 2024 18:15
-
-
Save teeparham/fe596755c50059160bce446e2c689f74 to your computer and use it in GitHub Desktop.
classnames & clsx replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://dev.to/gugaguichard/replace-clsx-classnames-or-classcat-with-your-own-little-helper-3bf | |
export function cx(...args: unknown[]) { | |
return args | |
.flat() | |
.filter((x) => typeof x === "string") | |
.join(" ") | |
.trim(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment