无法绑定React Js中的数据以动态加载Tab内容

时间:2016-03-30 19:26:47

标签: reactjs react-bootstrap

我希望绑定状态在地图中反应,下面是我的代码,

    <html>
    <script>
        var Hello = React.createClass({
            getInitialState: function(){
                return {
                    color: 'blue'
                };
            },
            handleClick: function(){
                if (this.state.color === 'blue'){
                    this.setState({className = " green"});
                } else {
                    this.setState({color: 'blue'});
                }
            },
            render: function() {
                return <button className={this.state.className} onClick={this.handleClick}>My background is: {this.state.color}, Click me to change</button>;
            }
        });

        React.render(<Hello name="World" />, document.getElementById('container'));

    </script>
    <body>
    <script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<style>
.green {
    background-color: lightgreen;
}

.blue {
    background-color: lightblue;
}
</style>

    <div id="container">
        <!-- This element's contents will be replaced with your component. -->
    </div>
    </body>
    </html>

但它不起作用,你可以帮帮我吗? 还有一件事,如何水平对齐右侧的所有标签,我们可以为每个标签设置图标吗?

0 个答案:

没有答案