Sreekar Mouli
Sreekar Mouli

Reputation: 1432

Reactjs - Unable to modify Input

I have created a two components:

  1. Comment - renders a comment's content and edit option(this option is created from the below component)
  2. EditComment - renders a link and onClick of that link renders a modal where comment can be edited.

The problem here is the input type='textarea' is fixed and I am unable to modify it.

Here is the working model of code:

Edit kxw3lvl78v

Upvotes: 0

Views: 49

Answers (1)

Joey Gough
Joey Gough

Reputation: 3103

in this function

handleChange(event) {
    this.setState({
        [event.target.name]: event.target.value
    });
}

event.target.name is blank

You have to add a name to the input like so.

<Input
    name="content"
    type="textarea"
    placeholder="Edit your Comment here!"
    value={this.state.content}
    onChange={this.handleChange}
    required
    />

Upvotes: 1

Related Questions