我正在尝试使用react和redux实现表单提交。当我在这里提交数据时,我希望得到结果(为了还原目的)。我知道我们可以通过在每个输入标签中给出'ref'来做到这一点。但我想用react-redux方法做什么呢。
您可以控制并查看作为对象获取的结果。但我没有得到正确的结果。
我想问题是你正在使用带有redux-form的<input
元素。
我推荐使用<Field name="title" component="input" type="text" />
代替。
import { reduxForm, Field } from 'redux-form'
<Field name="title" component="input" type="text" />
console.log("i want the results right here ",form.movieForm.values.title);
请注意:强烈建议在组件文件中创建一个捕获输入值的函数,然后调用dispatch
动作创建器