Redux 表单没有重新渲染

Redux form not getting re-rendered

我有一个动态下拉菜单。我在 componentWillMount 方法中获取动态值并在状态中设置。我将获取的值设置为 mapStateToProps 中的道具。 字段:

<Field name="productId" component={this.renderDropdown} />

我面临的问题是当使用新值更新状态时,会调用 render 方法但不会调用 renderDropdown 方法。所以下拉列表中没有填充我获取的值。

为了实现这个目标,我还需要做些什么吗?

将新数据作为 props 传递给 Field 。这些道具将与 Field 默认道具合并。像这样的东西

<Field
        name="productId"
        component={this.renderDropdown}
        newData={newData}
 />

and access the newData props in your component defined in this.renderDropdown