2017-03-01 115 views
1

正如我试图使用React-Bootstrap设置FormControl的值,我在控制台遇到错误。FormControl的react-bootstrap设置值

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> 

回答

5

这是正确的:

<FormControl value={someText}/>