Tag Archives: Need at least a key or a value or a label (only for OptGroup) for [object Object]

React Error: Need at least a key or a value or a label (only for OptGroup) for [object Object]

antd select  Component option value is empty

Find the assignment option and print the original data

Reason: a piece of useless data is returned in the background. For this error, the returned data will be filtered directly in the background; In order to avoid the front-end error caused by such useless data; The front-end adds judgment and filters data;

 let hospSelect = []
                    for (var i = 0; i < res.Hosp.length; i++) {
                        if(res.Hosp[i].id&&res.Hosp[i].descripts) hospSelect.push({res.Hosp[i].descripts})
                    }
                    this.setState({
                        hospSelect,
                    })