<title>hellow</title>
<script src= "Https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js" ></script>
<script src= "Https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js" ></script>
<meta charset= "Utf-8"/>
<body>
<div id= "root" >
</div>
<script type= "TEXT/JSX" >
Create a Build
var testbuttoncomponent = React.createclass ({
Handleclick:function (event) {
var tipse = React.finddomnode (this.refs.tips);
if (TipsE.style.display = = = ' None ') {
TipsE.style.display = ' inline ';
}else{
TipsE.style.display = ' None ';
}
Event.stoppropagation (); Block event bubbling
Event.preventdefault (); Block Default Events
},
Render:function () {
Return (
<div>
<button onclick={this.handleclick}> Show | Hide </button><span ref= "Tips" > Test button</span>
</div>);
}
});
var testinputcomponent = React.createclass ({
Getinitialstate:function () {
return {
Inputcontent: ' II '
};
},
Handlechange:function (event) {
This.setstate ({
InputContent:event.target.value
});
},
Render:function () {
Return (
<div>
<input type= "text" Onchange={this.handlechange}/> <span>{this.state.inputContent}</span>
</div>
);
}
});
Call a Build
React.render (
<div>
<testbuttoncomponent/>
<br/> <br/>
<br/>
<testinputcomponent/>
</div>,
document.getElementById (' root ')
);
</script>
</body>
React.js Test