Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 672
greyfox Avatar asked Jun 10 '26 20:06

greyfox


1 Answers

This is right:

<FormControl value={someText}/>
like image 85
Jesvin Jose Avatar answered Jun 13 '26 08:06

Jesvin Jose



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!