美文网首页
React笔记1

React笔记1

作者: hha123 | 来源:发表于2018-08-22 21:48 被阅读0次

//更新时

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

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)

??不是很明白道理


相关文章

网友评论

      本文标题:React笔记1

      本文链接:https://www.haomeiwen.com/subject/kwkuiftx.html