title: How do I go to a specific page in React based on a URL param
body: <p>As an example when entering <code>http://localhost:3000/ui/?goto=/ui/entity/e2</code> in the browser I'd like to go to the Entity component e2.</p>
  
  <p>This is my router:</p>
  
  <pre><code>&lt;Route path="/ui/" component={App}&gt;
          &lt;IndexRoute component={EntitiesPage} /&gt;
          &lt;Route      component={Entity}       path="entity/:id" /&gt;
          &lt;Route      component={NotFound}     path="*" /&gt;
  &lt;/Route&gt;
  </code></pre>
  
  <p>This is the App component:</p>
  
  <pre><code>import React from 'react'
  
  const App = React.createClass( {
      render() {
          let gotoUrl = this.props.location.query.goto;
          if (gotoUrl) {
              // go here: gotoUrl;
          } else {
              return (
                  &lt;div className="App"&gt;
                      {this.props.children}
                  &lt;/div&gt;
              )
          }
      }
  })
  export default App
  </code></pre>
  
  <p>this.context is empty.
  this.props has:</p>
  
  <ul>
  <li>history    </li>
  <li>location</li>
  <li>route</li>
  <li>routeParams (empty)</li>
  <li>routes</li>
  </ul>
  
  <p>UPDATE:
  I've ended up using this:</p>
  
  <pre><code>import React from 'react'
  import { withRouter } from 'react-router'
  
  const App = React.createClass( {
      componentWillMount() {
          let gotoUrl = this.props.location.query.goto;
          if (gotoUrl) {
              this.props.router.replace(gotoUrl);
          }
      },
  
      render() {
          return (
              &lt;div className="App"&gt;
                  {this.props.children}
              &lt;/div&gt;
          );
      }
  })
  export default withRouter(App)
  </code></pre>