ReactJS学习笔记2
1、this.setState方法每次修改后,自动调用this.render方法,再次渲染组件。
2、使用this.refs.refName获取真实的DOM节点
3、this.props和this.state区分方法:
- this.props: 表示一旦定义,不再改变的特性
- this.state: 表示会随着用户互动而产生变化的特性
4、组件的生命周期:
-
1) Mounting
- componentWillMount()
- componentDidMount()
-
2) Updating
- componentWillUpdate
- componentDidUpdate
-
3) Unmounting
- componentWillUnmount