First, the set of forms is dynamically added by clicking the plus sign, and its initialValue is set from a tree of selected values after resetFields each time a selectD onchange is performed


Then if you have a three-line form, change the state of the middle one, and delete the middle one. In theory, there are only 2 rows, and the first row is normal, but the state of the second row, the deleted row, is still displayed, even if selected has no option, as if defaultValue. I think it is a bug of ANTD. In order to solve this bug, I changed the State of the render list to an empty array first, and then rewrote the latest value to it, and then the State was right
deleteRule = (index) => { let { resetFields } = this.props.form; let ruleList = this.state.ruleList; ruleList = ruleList.filter((item, i) => i ! == index); This.setstate ({ruleList: []}, () => {this.setState({ruleList}); }); this.params = this.params.filter((item, i) => i ! == index); }Copy the code