简体   繁体   English

react-bootstrap设置FormControl的值

[英]react-bootstrap set value of FormControl

As I am trying to set the value of a FormControl using React-Bootstrap I am encountering an error in the console. 当我尝试使用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`.

The FormControl doesn't have a method for value so not sure how else to accomplish this. FormControl没有值的方法,因此不确定如何实现此目的。 This is how I am trying to set the value. 这就是我试图设置值的方式。

<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}/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM