formik in< input>标签
我正在使用),但是当我呈现表格时,我会在浏览器上收到一些警告,说:
Warning: Invalid value for prop `value` on <input> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.
这就是我呈现我的字段的方式,
<FormGroup>
<InputGroup>
<InputLabel>
{t('flightsCheckout.main.firstName')}
</InputLabel>
<Field name={`passengers[${index}].firstName`}>
{({field}) => (
<TextInput {...field} required
placeholder="E.G. John (Given Name)" type="text"/>
)}
</Field>
</InputGroup>
<DottedLinesContainer>
<DottedLines />
</DottedLinesContainer>
<InputGroup>
<InputLabel>
{t('flightsCheckout.main.lastName')}
</InputLabel>
<Field name={`passengers[${index}].lastName`}>
{({ field }) => (
<TextInput {...field} required placeholder="E.G. Smith (Last Name)" type="text"/>
)}
</Field>
</InputGroup>
</FormGroup>
如何清除这些警告?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论