title: React - get value of input on click
body: <p>I'm pretty new to React. I have a simple app where text is entered into an input field and then sent to a server when a button is clicked. How can I get the value of the input field? This is incredbily easy in jQuery but I can't figure it out with React.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import React, { Component } from 'react';
  import './App.css';
  
  class App extends Component {
      constructor(props){
          super(props)
  
          this.state = {
            terms: ''
          }
  
          this.updateTerms = this.updateTerms.bind(this);
      }
  
      updateTerms(evt) {
          this.setState({
              terms: evt.target.value
              })
      }
  
      search() {
  
          alert(this.state.terms)
      }
  
      render() {
  
      const btn1 = {
        width: '100%',
        backgroundColor: 'white'
      }
  
  
      return (
        &lt;div className= 'wrapper'&gt;
          &lt;div className= 'item1'&gt;
            Specials Fact Tree Demo
              &lt;/div&gt;
          &lt;div className= 'item2'&gt;
            Search Term(s):&lt;br/&gt;
              &lt;input className= 'form-control'  type="text" onChange={this.updateTerms} /&gt;
                &lt;br/&gt;
                  &lt;div id = 'results' &gt;
                    &lt;div id='resultsWrap' &gt;
                      &lt;select className= 'form-control' id= 'styles' &gt;&lt;/select&gt;
                    &lt;select className= 'form-control' id= 'similar' &gt;&lt;/select&gt;
  
                  &lt;div id= 'attsDiv' className= 'form-control' &gt;
                  &lt;dl id= 'atts'&gt;&lt;/dl&gt;
                &lt;/div&gt;
                  &lt;/div&gt;
  
  
  
              &lt;/div&gt;
            &lt;button className="btn btn-default" style = {btn1} id= 'search' onClick={this.search}&gt;Search&lt;/button&gt;
            &lt;div id="activeTraining" &gt;
  
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      );
    }
  }
  
  export default App;
  </code></pre>
  
  <p>Any help would be greatly appreciated. Plus, easy points!</p>