标签:ini var code ops ref 交互 理解 color init
var WebSite = React.createClass({ getInitialState() { return ( { name: ‘二手车‘, } ); }, onPress() { this.setState({ name: ‘新的‘ + this.state.name, }) }, render() { return ( <div onClick={this.onPress} > <Name name={this.state.name} /> </div> ); } }); var Name = React.createClass({ render() { return ( <h1>{this.props.name}</h1> ); } }); ReactDOM.render( <WebSite />, document.getElementById(‘example‘) )
标签:ini var code ops ref 交互 理解 color init
原文地址:http://www.cnblogs.com/zhansu/p/6899602.html