react-bem-classname
v0.0.2
Published
Generate BEM style classNames(reactive with states) for react component
Downloads
10
Readme
React BEM class-name generator
Install
npm i react-bem-classname
Example
import BEMProvider from 'react-bem-classname'
function Human() {
const style = BEMProvider('human')
const [isHurt, setHurtState] = useState('false')
return (
<section {...style()}>
<div {...style('::head')} />
<div {...style('::body')} >
<div {...style('::arm ::arm:left')} />
<div {...style('::arm ::arm:right', { hurt: isHurt })} />
</div>
<div {...style('::footer')} >
<div {...style('::leg ::leg:left')} />
<div {...style('::leg ::leg:right')} />
</div>
</section>
)
}
Concept
TODO