hope you’re doing well!
I am looking to set the value of Input from the state that i receive from props! I could set all the information from “profile” state in the placeholder but when putting it in the value field it doesn’t show anything
here’s my code :
the form i use :
<Form
name="basic"
wrapperCol={{ span: 24 }}
onFinish={onUpdate}
onFinishFailed={onFinishFailed}>
<FormItem>
<Input prefix={<ContactsTwoTone />} placeholder={profile.name} />
</FormItem>
<FormItem name="email"
rules={[
{
type: 'email',
message: 'The input is not valid E-mail!',
}
]}
>
<Input value={profile.email} name="name" prefix={<MailTwoTone />} placeholder={profile} />
</FormItem>
<FormItem name="mobile" value={profile.mobile} >
<Input value={profile.mobile} name="mobile" prefix={<PhoneTwoTone />} placeholder={profile.mobile} />
</FormItem>
<FormItem name="addres">
<Input name="addres" prefix={<HomeTwoTone />} placeholder={profile.addres} />
</FormItem>
<FormItem name="description">
<Input.TextArea name="description" placeholder="description" rows={4} prefix={<ContainerTwoTone />} />
</FormItem>
<FormItem>
<Button className="width-100" type="primary" htmlType="submit" onClick={onUpdate} >Update</Button>
</FormItem>
</Form> ```
the useEffect function and the declaration of state :
const [visible, setVisible] = useState(false);
const FormItem = Form.Item;
const [profile, setProfile] = useState({});
useEffect(() => {
setProfile(props.profile);
},[props.profile] );
const showDrawer = () => {
setVisible(true);
};