首页 > 代码库 > React 初学

React 初学

React.createClass({});

getInitialState,this.setState({});

{}解读代码块,外层不要加引号,比如onChange={this.handleChange}

ReactDOM.render(,ele);

 

ref=‘a‘,获取dom真实节点

1 var usernameDOM = this.refs.username.getDOMNode();  
2 var usernameDOM = React.findDOMNode(this.refs.username);  
3 var usernameDOM = this.refs[‘username‘].getDOMNode();  
4 var usernameDOM = React.findDOMNode(this.refs[‘username‘]);  

 

React 初学