The parent control only updates the state, causing the child control to trigger the componentWillReceiveProps

//Parent.js
class Parent extends React.Component {
    constructor() {
        super();
        this.state = {
            name: "zhangsan"
        }
    }

    test() {
        this.setState({
            name: "lisi"
        })
    }

    render() {
        return (
            <div>
                <button onClick={this.test.bind(this)}>gogo</button>                
                <Sub1 />
            </div>
        )
    }
}

export default Parent
//Sub1.js
class Sub1 extends React.Component {
    componentWillReceiveProps(nextProps) {        
        console.log("componentWillReceiveProps from sub1")
    }

    render() {
        return <div>Sub1x</div>
    }
}

export default Sub1

props is not set when loading Sub1 in Parent.
is it reasonable that the state in Parent changes when the button is clicked, causing the componentWillReceiveProps event to be triggered in Sub1?

Mar.09,2021

Edit 5v5x97lo7l
this is true because the state of the parent component has changed and the parent component has been updated, but the child component has been updated without referencing any properties, which is indeed not very reasonable, although there will not be any changes after the final dom diff

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37d27-2b918.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37d27-2b918.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?