Invalid getDerivedStateFromProps in React v16.3.2?

react has been upgraded to version 16.3.2

"react": "^16.3.2",
"react-dom": "^16.3.2",

method rewriting:

// brfore
componentWillReceiveProps(nextProps: Props) {
        console.log(nextProps);
        this.setState({
            value: setCurrentStyleToSelect(nextProps, this.props.regex, this.props.defaultValue),
        });
    }
    
// now
static getDerivedStateFromProps(nextProps: Props, prevState: Props) {
    console.log(nextProps);
    console.log(prevState);
    if (nextProps !== prevState) {
        return {
            value: setCurrentStyleToSelect(
                    nextProps,
                    prevState.regex,
                    prevState.defaultValue,
                ),
        };
    }
    return null;
}

the current console cannot be entered; none of the methods in getDerivedStateFromProps have been executed

Mar.07,2021

you have deleted both the node_modules folder and package-lock.json, and try again npm install .

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-1b352fb-2bfa0.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-1b352fb-2bfa0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?