The problem of updating the initial value of react antd getFieldDecorator

when I initialize the Input component of the Form form, I set the initalValue property of getFieldDecorator . This initial value depends on the value stored in Redux , and the Redux value is the data passed in the background.

the problem now is that when I click Save and modify successfully, the data will be pulled again and the data passed by the background will be updated. The value of redux is also updated, while initalValue is not updated dynamically. The page will not be updated until it is refreshed.

try to use setFieldsValue to set the value of Input , but it can cause an endless loop in many lifecycles.

is there any way to make the value of the Input component change with the data in Redux ?

Mar.10,2021

in the method that you click to save, just resetFields . The options in the Form.create (options) (ReactNode) method in


antd can do this. For more information on how to use it, please see the document https://2x.ant.design/compone.

.
Menu