如何解决我无法在 Semantic UI React 中编辑输入值我使用了 onChange 但它不起作用所有其他功能都完美运行
这里我使用 react hooks 设置初始状态和目标状态。在 from 组件中,我使用 Semantic UI React from 在输入中创建表单使用值,以设置一些已经通过表单输入的默认值。使用 onChange 编辑值但它不起作用。但 onChange 工作正常。
Parent Component
const ParentPane = (props) => {
const dispatch = usedispatch();
const [appName,setAppName] = useState([{ appName: props?.rowEditData?.appName }]);
const [pattern,setPattern] = useState("");
const [desc,setDesc] = useState("");
const [parentData,setParentData] = useState({
appName: "",pattern: "",desc: ""
});
Form Component
<Form size="large" inverted className="parentStyle">
<div>
<Form.Input
fluid
id="app"
name="appName"
label="Application Name"
value={props?.rowEditData.appName}
onChange={(event) => setAppName(event.target.value)}
/>
<Form.Input
fluid
id="path"
name="pattern"
label="Request Path"
placeholder="eg: /home"
value={props?.rowEditData.pattern}
onChange={(event) => setPattern(event.target.value)}
/>
<Form.Input
fluid
path="des"
name="desc"
label="Description"
value={props?.rowEditData.description}
onChange={(event) => setDesc(event.target.value)}
/>
<Button
className="submitButton"
onClick={(event) => saveOrUpdateMock(event,"UPDATE")}
style={style.labelStyle}
>
Save
</Button>
</div>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。