greyfox
greyfox

Reputation: 6606

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.

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. 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>

Upvotes: 2

Views: 13156

Answers (1)

Jesvin Jose
Jesvin Jose

Reputation: 23088

This is right:

<FormControl value={someText}/>

Upvotes: 10

Related Questions