[英]Giving an input a default value in redux-form
I would have thought this is stupidly easy... but I am struggling :D 我本以为这很简单...但是我在努力:D
<Field type="text" component="input" value="jamie" name="email" placeholder="Enter email address"/>
<Field type="text" component="input" defaultValue="jamie" name="email" placeholder="Enter email address"/>
<Field type="text" component="input" format="jamie" name="email" placeholder="Enter email address"/>
I just can't get one in there. 我只是不能在那里进来。
define initialValues
outSide of your class 在类的外部定义
initialValues
const initialValues = {
email: 'example@gmail.com'
}
and put initialValues here 并在此处放置initialValues
export default reduxForm({
form: 'venues', // a unique identifier for this form
destroyOnUnmount: true,
validate,
initialValue
})(VenueComponent)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.