The React setStats array is not updated, which makes it hard to understand.

the building encountered a tricky problem today.
is that this.setStats ({}) does not update this.stats.
the problem is
constructor (props) {

.
    super(props);
    this.state = {
        imageList: []
    }

    WechatService.getMaterialOrealList("image").then((result) => {
        this.setState({
            imageList: result
        })
    });

}

 async handleInputChangeUpload(event) {
    var target = event.target;
    var file = target.files[0];

    var formData = new FormData();
    formData.append("file", file);

    var result = await WechatService.updateMaterialImage(formData);

    var lists = this.state.imageList;
    lists.push(result);
    console.log(lists);
    //
    this.setState((prevState, props) => ({
        imageList: lists
    }))

}


11 render

this.setState((prevState, props) => ({


elementsUI
constructor(props) {


}

componentWillMount() {


}

handleUpload() {


}

async handleInputChangeUpload(event) {


}


Why is this?
cannot answer

author: silly Dream
Link: https://juejin.im/post/5b1a22.
Source: Nuggets
copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.

Mar.18,2021

  

setstate only make shallow comparisons

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