title: react router passing variable/state to new route?
body: <p>I have a dynamic variable that is made in one component and then that component routes to another component. How do i pass the variable?</p>
  
  <p>COMPONENT A</p>
  
  <pre><code>import React, { Component } from 'react';
  
  class Event extends React.Component {
     makeVariable(event)
     { myVariable = '123abc' }
  
     {window.location.replace("/B")}
  
     render () { return (html for page A)
  }
  export default A;
  </code></pre>
  
  <p>COMPONENT B</p>
  
  <pre><code>import React, { Component } from 'react';
  
  class B extends Component {
      render(){ console.log(myVariable)}
  }
  export default B;
  </code></pre>
  
  <p>ROUTES FILE</p>
  
  <pre><code>export const makeMainRoutes = () =&gt; {
    return (
      &lt;Router history={history}&gt;
          &lt;div&gt;
            &lt;Route path="/A" render={(props) =&gt; &lt;App auth={auth} {...props} /&gt;} /&gt;
            &lt;Route path="/B" render={(props) =&gt; &lt;Home auth={auth} {...props} /&gt;} /&gt;
  )}
  </code></pre>