title: get the value of text area by GetElementByName
body: <p>am trying to add the value of a textarea to the state of my component. but it doesn't seem to be working. in console.log . it gives me the id correctly but the value as undefined .
  the addListItem is triggered by a button.</p>
  <pre><code>import React from &quot;react&quot;;
  import ReactDOM from &quot;react-dom&quot;;
  
  import &quot;../../styles/styles.css&quot;;
  
  class BlockInput extends React.Component {
    state = {
      items: [{ id: 0, value: &quot;&quot; }],
    };
  
    addListItem = () =&gt; {
      console.log(this.state);
      var x = parseInt(document.getElementById(&quot;seed&quot;).innerHTML);
  
      const newItem = {
        id: x,
        value: document.getElementsByName(&quot;hi&quot;).text,
      };
  
      document.getElementById(&quot;seed&quot;).innerHTML = x + 1;
      this.setState({
        items: [...this.state.items, newItem],
      });
    };
  
    createList = () =&gt; {
      const { items } = this.state;
      return items.map((item) =&gt; {
        return (
          &lt;div&gt;
            &lt;textarea className=&quot;item&quot; id={item.id} type=&quot;text&quot; name=&quot;hi&quot; &gt;&lt;/textarea&gt;
            &lt;button type=&quot;button&quot; onClick={(e) =&gt; this.handleDelete(item)}&gt;
              delete
            &lt;/button&gt;
          &lt;/div&gt;
        );
      });
    };
  </code></pre>