Ionic React-Redux-IonInput OnIonChange未将值传递给操作



我正在尝试将redux用于离子反应应用程序,但无法使用onIonChange捕获输入。它在正常的useState中运行良好,但当我尝试用Redux更新状态时,值永远不会更新到状态

const onInputChangeHandler2 = (event: any, inputIdentifier: string) => {
props.onAddAttribute({identifier: inputIdentifier, values: event.target.value});
};
<IonItem>
<IonLabel position="floating">Attribute Name</IonLabel>
<IonInput key="attributeName"
onIonChange={(event) =>
onInputChangeHandler2(event, "name")
}
value={attribute.name}
/>
</IonItem>

减速器:

const addAttribute = (state, action) => {
const updatedAttribute = {[action.payload.identifier] : action.payload.values}
return updateObject(state, updatedAttribute);
};
const updateObject = (oldObject, updatedObject) => {
return{
...oldObject,
...updatedObject
};
};
onInputChangeHandler2(event);

线路应该是吗

onInputChangeHandler2(event, attribute.name);

相关内容

  • 没有找到相关文章

最新更新