我这点了咋没反应呢!哪写错了? 财富值93

2016-10-13 14:47发布

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Document</title>     <script src="js/react.js"></script>     <script src="js/react-dom.js"></script>     <script src="js/browser.min.js"></script> </head> <body>  <div id="example_1"></div>  <div id="example_2"></div>  <script type="text/babel">       var A = React.createClass({         getInitialState:function(){             return {count:0};         },         render:function(){             return <div>{this.state.count}</div>         },         eventClick:function(){             this.setState({                 count: this.state.count+1,             })         }     });       ReactDOM.render(<div>                          <A class="a"/>                          <input type="button" onClick={A.eventClick}/>                      </div>,              document.getElementById("example_1")      );   </script> </body> </html>
2条回答

写法不正确,你的组件是渲染到A上了,和下面的input 没关系。

一周热门 更多>