title: Update URL with value from input on click with React
body: <p>I'm trying to get the value of an input to be captured and then to update part of the URL with that value, all by doing a simple on click with React, ES6 etc. Basically a simple search functionality</p>
  
  <p>So my component looks something like this:</p>
  
  <pre><code>class SearchInput extends Component {
    constructor() {
      super()
  
      this.state = {
        query: ''
      }
    }
  
    componentDidMount = () =&gt; {
      const handleSearchURL = window.location('/search/'+this.state.query+'/some-action')
      this.setState({
        handleSearch: handleSearchURL
      })
    }
  
    queryChange = (evt) =&gt; {
      this.setState({query: evt.target.value})
    }
  
    render() {
      const { handleSearch, placeholder } = this.props
      return (
        &lt;form&gt;
          &lt;input id="site-search" type="search" placeholder={placeholder} value={this.state.query} /&gt;
          &lt;input type="submit" value="Search" onClick={this.handleSearch} /&gt;
        &lt;/form&gt;
      )
    }
  }
  </code></pre>
  
  <p>but this just gives me a lot of errors and it seems to don't like window.location. What's the best way to achieve this? I'm using react-router so I'm also happy if there is a better way with that</p>