2017-07-04 65 views
0

有没有办法用change方法取消设置/删除变量集? 在我的代码编程设置字段这样从REDEX商店删除字段

this.props.change('extraBedChildrenNum', 1); 

但我想故从商店移除来取消这一领域。任何想法如何做到这一点?

回答

1

没有动作创建者从提供给装饰组件的表单中删除字段作为道具,但there is one exported by redux-form调用unregisterField

所以,你应该能够做这样的事情:

store.dispatch(unregisterField('MyFormName', 'extraBedChildrenNum')) 

希望这有助于!

0

github issue

import {change} from 'redux-form'; 

dispatch(change('myForm', 'myField', 'newValue')) 

这应该有助于

+0

这将设置'myField'到'newValue';我需要的是从'myForm'中删除'myField'。 – Dario