const color = className({ color: 'blue' });
const background = className({ background: 'yellow' });
function MyComponent() {
return (
<div className={cx(color, background)}>
Colorized
</div>
);
}
const color = className({ color: 'blue' });
const background = className({ background: 'yellow' });
function MyComponent(props) {
return (
<div
className={cx(color, {
// Set the background color only if `props.isActive` is `true`
[background]: props.isActive,
})}
>
Colorized
</div>
);
}
Merges multiple classNames