0
我有組件包含字段,我使用的是redux窗體。 我用道具的初始值在我的容器是這樣的:Redux窗體沒有正確初始化
const mapStateToProps = (state, ownProps) => {
const quantity = formsState(state).getIn([
'orderEntry', 'values', 'quantity']);
const price = formsState(state).getIn([
'orderEntry', 'values', 'price']);
return {
initialValues: fromJS({
quantity: ownProps.quantity,
price: ownProps.price,
}),
};
};
然後我用一個刷新按鈕,通過它我派遣一個動作,使我的價格應該更新。刷新按鈕重新運行此組件。但檢查狀態,我看到價格沒有設置爲我分配的初始價格。爲什麼initialValues沒有執行?