【问题标题】:If you want to write it to the DOM, pass a string instead: w="true" or w={value.toString()}如果要将其写入 DOM,请改为传递字符串:w="true" 或 w={value.toString()}
【发布时间】:2020-04-13 16:43:08
【问题描述】:

渲染时出现此错误:

警告:收到非布尔属性“w”的“真”。 如果要将其写入 DOM,请改为传递字符串:w="true" 或 w={value.toString()}。

当我删除代码下方的代码时,错误消失:

<div className="form-group">
  <div className="col-12">
    <label htmlFor="inputConfirmType">Type de confirmation</label>
    <select id="inputConfirmType" name="confirmType" className="form-control" onChange={this.handleInputChange} required>
      <option value=""w>Selectionner un type</option>
      <option value="Ecole">Ecole</option>
      <option value="Professeur">Professeur</option>
      <option value="Inspecteur">Inspecteur</option>
    </select>
  </div>
</div>

【问题讨论】:

  • 删除代码中不必要的w

标签: reactjs ecmascript-6


【解决方案1】:

在您的一个选择选项中浮动有一个松散的“w”:

<option value=""w>Selectionner un type</option>

这就是罪魁祸首。应该是:

<option value="">Selectionner un type</option>

【讨论】:

    【解决方案2】:

    你错过了双引号“”之间的书写:

    <option value=""w>Selectionner un type</option>
    

    应该是:

    <option value="w">Selectionner un type</option>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-12
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      • 2012-05-19
      相关资源
      最近更新 更多