Ann*_*erg 4 reactjs redux react-redux
我想运行一个函数并在我的输入值中传递一些参数,但它给了我这个错误:
Invalid value for prop值on <input> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.
我记得曾经在某处读过您可以在 中使用函数value,但这对我不起作用。还有别的办法吗。
value={() => this.handleMapping(row.servername, "Data Source Server")}
Run Code Online (Sandbox Code Playgroud)
错误:Invalid value for prop值on <input> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM.
您在这里提供了一个匿名函数,
value={() => this.handleMapping(row.servername, "Data Source Server")}
Run Code Online (Sandbox Code Playgroud)
相反,您只需提供函数,该函数将在组件加载时执行。
value={this.handleMapping(row.servername, "Data Source Server")}
Run Code Online (Sandbox Code Playgroud)
还要确保您的handleMapping函数应该返回可以视为输入值的内容。
注意:还要确保提供onChange输入处理程序。
| 归档时间: |
|
| 查看次数: |
4201 次 |
| 最近记录: |