我正在使用React-Select
但出现错误
数据不能选择多个
查看屏幕截图 https://ibb.co/m9TKG5p
const [languageSelect, setLanguageSelect] = useState([]);
<Select
closeMenuOnSelect={false}
components={animatedComponents}
isMulti
options={returnSkills}
name="SkillsSelect"
onChange={skills => setSkillsSelect(skills)}
/>
我尝试设置从api获取并设置值的相同数据
like-:
let skilsSelect = data.get_skills_by_user;
let skilsSelects = [];
if (skilsSelect) {
for(let i = 0; i < skilsSelect.length; i++){
skilsSelects.push(skilsSelect[i].get_skills);
}
setSkillsSelect(skilsSelects);
}
<Select
closeMenuOnSelect={false}
components={animatedComponents}
isMulti
options={returnSkills}
name="SkillsSelect"
value={SkillsSelect}
onChange={skills => setSkillsSelect(skills)}
/>
如果有人有任何解决方案,请指导我。