Fork me on GitHub

李可

导航

react笔记

static getDerivedStateFromProps(nextProps, prevState) {
console.log('getDerivedStateFromProps',nextProps, prevState)
}
componentDidMount() {
console.log('componentDidMount',this.props, this.state)
}
shouldComponentUpdate(nextProps, nextState) {
console.log('shouldComponentUpdate',nextProps, nextState)
return true
}
getSnapshotBeforeUpdate(prevProps, prevState){
console.log('getSnapshotBeforeUpdate',prevProps, prevState)
return 222
}
componentDidUpdate(prevProps, prevState,snapshot) {
console.log('componentDidUpdate',prevProps, prevState,snapshot)
}
render(){
return <React.Fragment>地图Component</React.Fragment>
}
getDerivedStateFromProps {orderId: "35201366854752"} {}
componentDidMount {orderId: "35201366854752"} {}

getDerivedStateFromProps {orderId: 2} {}
shouldComponentUpdate {orderId: 2} {}
getSnapshotBeforeUpdate {orderId: "35201366854752"}ref: (...)orderId: "35201366854752"get ref: ƒ ()proto: Object {}
componentDidUpdate {orderId: "35201366854752"} {} 222

posted on 2019-12-30 15:43  李可在江湖  阅读(150)  评论(0编辑  收藏  举报