I am new to ReactJS and JSX and I am having a little problem with the code below.
I am trying to add multiple classes to the className attribute on eac
When I have many varying classes, I have found the following to be useful.
The filter removes any of the null values and the join puts all the remaining values into a space separated string.
const buttonClasses = [
"Button",
disabled ? "disabled" : null,
active ? "active" : null
].filter((class) => class).join(" ")