当我尝试使用 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/