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