jsxclassnames
v1.2.0
Published
The function will receive an object and will return a classname per truthy property.
Downloads
9
Readme
My own jsxclassnames
A light helper to generate your react classes dynamically.
How to use it
The helper will receive a number|string|obj|array|undefined|null and will return all the truthy properties.
Component
import jsxclassnames from 'jsxclassnames'
<div
className={jsxclassnames(
{ 'test--one': true, 'other-class': 0 },
'myclass',
['myotherclass', current === id],
})}
/>
Component rendered
<div class="test--one myclass myotherclass"></div>