title: Open component in new URL (React)
body: <p>I have component with a button. I'd like a component to open another component in the new URL when the button is pressed. I don't want other components on the new page. I also want to pass data to a new component.</p>
  <p><strong>UPDATE:</strong></p>
  <pre><code>&lt;BrowserRouter&gt;
      &lt;Link onClick={this.getData.bind(this)}  to={{ pathname: &quot;/test&quot;, data: this.state.data }}&gt;Begin&lt;/Link&gt;
      &lt;Switch&gt;
          &lt;Route exact path=&quot;/test&quot; component={Test} /&gt;
      &lt;/Switch&gt;
  &lt;/BrowserRouter&gt;
  </code></pre>
  <p>I wrote some code, but I have 2 problems:</p>
  <ul>
  <li>How can I fetch data before route?</li>
  <li>My component &quot;Test&quot; render on this page with previous components, I want only &quot;Test&quot; component on page</li>
  </ul>