0
出于某种原因,字段值未打印到我的customComponent常量中。未在自定义组件中打印的字段值
const CustomComponent = function(field) {
console.log(field.input.value); //blank, no value
return (
<div>
<input { ...field.input } type={field.type} placeholder={field.placeholder} className={field.className} />
</div>
);
}
......
<Field name="test" component={CustomComponent} type="text" placeholder="Test" value="testvalue" />
你可以在输入中输入,但在日志中只能看到“undefined”?你的代码看起来很好。 –