我有一个选择:
<Select isClearable classNamePrefix="select" ref={myRef} menuPortalTarget={document.body} styles={style} placeholder="Select Foods" name="Foods" value={inputField.foods} options={options} onChange={event => handleInputChange2(index, event)} className="select selectNarrow">
我有一个按钮,就是清除所有的选择:
<IconButton size="small" aria-label="edit" onClick={() => handleRemoveFieldsAll(index)}><RemoveCircleIcon /></IconButton>
该功能:
const handleRemoveFieldsAll = (index, event) => {
const values = [...inputFields];
setInputFields(INITIAL_STATE);
values.splice(0);
console.log(values);
};
这一工作通过消除和排空阵列,但标记的选择仍然存在。 我怎么清所有剩余片公司的财产回到占位?