![](/img/trans.png)
[英]error TS2339: Property 'props' does not exist on type 'TestPage'
[英]error TS2339: Property 'for' does not exist on type 'HTMLProps<HTMLLabelElement>'
使用typescript並對具有明確類型定義的TSX文件做出反應,我收到錯誤:
error TS2339: Property 'for' does not exist on type 'HTMLProps<HTMLLabelElement>'.
嘗試使用以下TSX編譯組件時
<label for={this.props.inputId} className="input-label">{this.props.label}</label>
我已經解決了,但在這里為下一個人添加,因為解決方案在搜索時沒有出現在任何地方(Google或StackOverflow)
解決方案是將for
屬性更改for
htmlFor
<label htmlFor={this.props.inputId} className="input-label">{this.props.label}</label>
這是陣營庫本身,這顯然處理的一部分, for
不同就像它class
(它使用className
),而不是一個問題與絕對輸入類型定義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.