-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Closed
Description
I konw the classnames package can resolve the problem,
but I want react support this by default without classnames package.
classnames is good, but when I want to use it, I should type a long name,
and the mostly time, I don't have installd it, but I need to do a little code to merge classname to install it.
and a little different to classnames
- className can accept a array (any[]), not support object.
- className still accept a string
<div className={['a', 'b']}></div>
to
<div className="a b"></div>
and filter the string item to be the className
this can do some conditions, like jsx (true &&
<div className={[
'a b c',
true && 'd',
false && 'f',
null && 'g',
0 && 'h',
undefined && 'i',
]}></div>
to
<div className="a b c d"></div>
davidfurlong and xfournet
Metadata
Metadata
Assignees
Labels
No labels