import React, { Component } from 'react'
export default class HCom extends Component {
UNSAFE_componentWillMount(){
console.log('componentWillMount')
}
componentDidMount(){
console.log('componentDidMount')
}
UNSAFE_componentWillReceiveProps(newProps) {
console.log('Component WILL RECEIVE PROPS!')
}
shouldComponentUpdate(newProps, newState) {
return true;
}
UNSAFE_componentWillUpdate(nextProps, nextState) {
console.log('Component WILL UPDATE!');
}
componentDidUpdate(prevProps, prevState) {
console.log('Component DID UPDATE!')
}
componentWillUnmount() {
console.log('Component WILL UNMOUNT!')
}
state={
msg:'sb'
}
change=()=>{
this.setState({
msg:'lc'
})
}
render() {
console.log('render')
return (
<div>
{this.state.msg}
<button onClick={this.change}>edit</button>
</div>
)
}
}