1.2.0 • Published 3 years ago
jsxclassnames v1.2.0
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>