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
标签:orderId,prevState,console,log,nextProps,笔记,react,35201366854752 来源: https://www.cnblogs.com/leee/p/12120082.html