React笔记1

2018-08-22  本文已影响0人  hha123

//更新时

子组件有这两个函数相当于是监听或者说是响应父组件的某些变化:

componentWillReciveProps(newData) //父组件改变的新状态值

shouldComponentUpdate  //return false 表示不更新,return true表示更新

componentWillUpdate

componentDidUpdate


销毁

ReactDOM.unmountComponentAtNode(document.getElementById('.....'))

componentWillUnmount


选择元素

ReactDOM.findDOMNode(this.refs...)


在构造函数中对事件函数进行bind(this)

this.xxx=this.xxx.bind(this)

??不是很明白道理


上一篇 下一篇

猜你喜欢

热点阅读