How does the antDesign Form form initialValue change after manual input?

antDesign Form can assign default values to input in the following ways:

const myValue = random() // 
...
{
    getFieldDecorator("userName", {initialValue: myValue}]})(  <Input /> )
}

as shown in the code above, the initial value of Input changes in my requirements.

however, after I manually type in the input box, the program cannot assign a value to the input box, that is, no matter how the value of myValue changes, the value displayed in the input box on the screen is the one I entered manually.

the essential reason for my analysis is that initialValue sets the default value of the Input component, and once Input has a value, which I entered manually, the default value is invalid.

but when using Form getFieldDecorator, is there a way to set value, directly to Input? what should I do?

Mar.14,2021

this.props.form.setFieldsValue({
  key: value
});

resolved:

Form.create({
    mapPropsToFields(props) {
        ...
        result[yourKey] = Form.createFormField({
           value: yourValue,
        });
        return result
    }
})(<YourComponent/>)

Menu