[React] React Fundamentals: Add-on ClassSet() for ClassName

To get the add-ons, use react-with-addons.js (and its minified counterpart) rather than the common react.js.

<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js"></script>-->
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>

https://facebook.github.io/react/docs/addons.html

 

    var BHeart =
            React.createClass({
                render:function(){
                    var cx = React.addons.classSet;
                    var classes = cx({
                        'glyphicon': true,
                        'glyphicon-heart': true
                    });
                    return <span className={classes}></span>
                }
            });

 

posted @ 2015-03-24 17:05  Zhentiw  阅读(365)  评论(0)    收藏  举报