React: Invoke redirect to page, and pass parameter
<p>I am building my first React app.
In my code, I redirect to another page (a component) using</p>

<pre><code>browserHistory.push(pathToMyComponent)
</code></pre>

<p>I also have tried out the react-router Link-element. The Link element enables me to pass data to the target component without having it showing up in the URL, like this:</p>

<pre><code>&lt;Link to={`/myComponent/${someData}`}&gt;
</code></pre>

<p>But now I don't want to create a link. Instead I want to perform some operations when pushing a button, and then redirect with some calculated data.
How do I do this?</p>

<p>Edit:
Here is my code. In loginpage, the user can perform a facebook login. What I want is to redirect the user to the lobby after login succeeded. I want to pass the userid to the lobby.</p>

<pre><code>&lt;Router history={browserHistory} onUpdate={() =&gt; window.scrollTo(0, 0)}&gt;
   &lt;Route path="/" component={LoginPage}/&gt;
   &lt;Route path="/lobby" component={Lobby}/&gt;
&lt;/Router&gt;
</code></pre>

<p>This is what I wrote after reading your answer. When this is executed, the log prints <code>Uncaught TypeError: Cannot read property 'context' of null</code></p>

<pre><code>this.context.router.push({ //browserHistory.push should also work here
     pathname: '/lobby',
     state: {userid: authData.uid}
});
</code></pre>

<p>Edit2: You mean like this? It gives syntax error. </p>

<pre><code>class LoginPage extends React.Component {

  contextTypes = {
    router: React.PropTypes.object
  };
  constructor(props){
    super(props);
...
...
</code></pre>