admin管理员组

文章数量:1279021

As I am trying to set the value of a FormControl using React-Bootstrap I am encountering an error in the console.

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 acplish this. This is how I am trying to set the value.

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

As I am trying to set the value of a FormControl using React-Bootstrap I am encountering an error in the console.

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 acplish this. This is how I am trying to set the value.

<FormGroup controlId="parameterDescription">
    <ControlLabel>Description</ControlLabel>
    <FormControl ponentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
        {this.state.description}
    </FormControl>
</FormGroup>
Share Improve this question asked Mar 1, 2017 at 13:28 greyfoxgreyfox 6,61624 gold badges74 silver badges116 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

This is right:

<FormControl value={someText}/>

本文标签: javascriptreactbootstrap set value of FormControlStack Overflow