redux-form 是否在函数工作时更改 prop 参数值?
Does redux-form change prop argument value as function work?
我有"redux-form": "^7.4.2"
。
我在文档中看到:
change(field:String, value:any) : Function Changes the value of a
field in the Redux store. This is a bound action creator, so it
returns nothing. You could get current field-value & form-values while
value is a function, For example: change(field, (fieldValue,
allValues) => {})
我尝试做:
dispatch(
change(formName, fieldName, (val, allValues) => {
/* do something with arguments */
return theResultOfTheAboveCode;
}),
);
它不起作用。但是下面的代码工作正常:
dispatch(change(formName, fieldName, someValue));
作为值的函数是否有效?
您使用的 7.4.2
没有作为函数的值。
文档在 https://redux-form.com/7.4.2/docs/api/props.md/
下
作为函数的值存在于最新的 8.x.x https://redux-form.com/8.1.0/docs/api/props.md/
我有"redux-form": "^7.4.2"
。
我在文档中看到:
change(field:String, value:any) : Function Changes the value of a field in the Redux store. This is a bound action creator, so it returns nothing. You could get current field-value & form-values while value is a function, For example: change(field, (fieldValue, allValues) => {})
我尝试做:
dispatch(
change(formName, fieldName, (val, allValues) => {
/* do something with arguments */
return theResultOfTheAboveCode;
}),
);
它不起作用。但是下面的代码工作正常:
dispatch(change(formName, fieldName, someValue));
作为值的函数是否有效?
您使用的 7.4.2
没有作为函数的值。
文档在 https://redux-form.com/7.4.2/docs/api/props.md/
下作为函数的值存在于最新的 8.x.x https://redux-form.com/8.1.0/docs/api/props.md/