React的输入值不能和状态一起工作



我有奇怪的错误。当我尝试改变我的输入值与状态,它不工作,但如果我写我的状态一些空白的地方,所以它开始改变值。为什么会这样?我的代码:

<Form
className="mt-4"
layout="vertical"
requiredMark="hidden"
name="basic"
form={form}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
<Form.Item
name="Name"
label="Başlık"
style={{ width: 400 }}
rules={[{ required: true, message: "Lütfen Başlık Giriniz!" }]}
>
<Input
id="IDTitle"
placeholder="Başlık"
onChange={handleInputChange}
/>
</Form.Item>
<Form.Item name="Url" label="URL" style={{ width: 400 }}>
{titleData} // if i write it its working. But if i delete that row its not shows or update value.
<Input placeholder="Url" disabled value={titleData}></Input>
</Form.Item>


<Button
type="primary"
className="submitButton float-right"
htmlType="submit"
>
Submit
</Button>
</Form.Item>
</Form>
const handleInputChange = (e) => {
const data = e.target.value;
console.log(data);
setTitleData(toEnglishChar(data));
};

我怎么解决它?感谢所有的回复!我不知道为什么会这样,但我已经尽力了。我尝试改变和输入默认输入,但它没有工作太。感谢所有的回复!!

按如下方式更改onChange事件:

<Input
id="IDTitle"
placeholder="Başlık"
onChange={e => handleInputChange(e)}
/>

最新更新