React Bem Render
just a simple bem render to auto add bem classes in a component.
Usage
Use as a mixin:
var ReactBemRender = ;var Component = React;
this will transform to
<header class='block-name block-name--active'> <h1 class='block-name__title'></h1> <p></p> </header>
or use decorator
var bemDecorator = bemDecorator;var Component = React;
Some rules
- when
block
andelem
be used together, they will be a mix. - mods will be worked with
block
by default, if noblock
, it will be worked withelem
. - for React Component if
block
set, it will render in parent.
more examples, please see the test cases.
Change Logs
0.2.0
update to support React 0.13.x< 0.1.6
only support React 0.12.x