gpt4 book ai didi

reactjs - 错误 : input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`

转载 作者:行者123 更新时间:2023-12-04 14:37:29 32 4
gpt4 key购买 nike

import React , { Component } from 'react'

class Login extends Component{
constructor(props){
super(props)

}
render(){
return(
<form className="login-form">
<h1>login</h1>
<div>
<div className="form-group">
<label for="name">
Name :
</label>
<input name="name" type="text" value="" placeholder="Your Name" />
</div>
<div className="form-group">
<label for="password">
Password :
</label>
<input name="password" type="Password" value="" placeholder="Password" />
</div>
<input type="submit">Submit</input>
</div>
</form>
)
}
}

export default Login

最佳答案

我觉得问题出在这里

//input is an empty tag and you have provided Submit as children here
<input type="submit">Submit</input>

应该是简单的这个
<input type="submit" value="Submit" />

关于reactjs - 错误 : input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58830198/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com