gpt4 book ai didi

javascript - react-bootstrap 设置 FormControl 的值

转载 作者:行者123 更新时间:2023-12-02 07:22:16 25 4
gpt4 key购买 nike

当我尝试使用 React-Bootstrap 设置 FormControl 的值时,我在控制台中遇到错误。

invariant.js:44 Uncaught Error: Objects are not valid as a React child (found: [object HTMLTextAreaElement]). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of `FormGroup`.

FormControl 没有获取值的方法,因此不确定如何完成此操作。这就是我尝试设置值的方式。

<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>

最佳答案

这是对的:

<FormControl value={someText}/>

关于javascript - react-bootstrap 设置 FormControl 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42533068/

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