<script type="text/jsx">
var TestState = React.createClass({
//返回一个默认值
getInitialState:function(){
return {
//是否显示出来
isVisible: true,
title: '测试State',
}
},
render:function(){
return (
<div>
//this.state 存储数据
<h1>{this.state.title}</h1>
</div>
)
}
});
var aaa = React.render(
<TestState />,
document.getElementById('TestCont'),
function(){
console.log('渲染完成。。。');
}
)
</script>
网友评论