点击显示没有效果,大神帮着看看
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<script src="https://cdn.bootcss.com/react/15.4.2/react.min.js"></script>
<script src="https://cdn.bootcss.com/react/15.4.2/react-dom.min.js"></script>
<script src="https://cdn.bootcss.com/babel-standalone/6.22.1/babel.min.js"></script>
</head>
<body>
<div id="1"></div>
<script type="text/babel">
var TestClickComponent=React.createClass({
handleClick:function(event){
var tipE=React.findDOMNode(this.refs.tip);
if(tipE.style.display==='none'){
tipE.style.display='inline';
}else{
tipE.style.display='none';
}
event.stopPropagation();
event.preventDefault();
},
render:function(){
return(
<div><button onClick={this.handleClick}>显示|隐藏</button><span ref="tip">测试按钮</span></div>
);
}
});
var TestInputComponent = React.createClass({
getInitialState:function(){
return{
inputContent:''
}
},
changeHandler:function(event){
this.setState({
inputContent:event.target.value
});
event.stopPropagation();
event.preventDefault();
},
render:function(){
return(
<div><input type="text" onChange={this.changeHandler}/><span>{this.state.inputContent}</span></div>
);
}
});
ReactDOM.render(
<div><TestClickComponent/>
<br/><br/>
<TestInputComponent/></div>,
document.getElementById('1')
);
</script>
</body>
</html>