title: Redirect with "componentDidMount()" : problem (React)
body: <p>I have some code that works. It immediately reroutes a user from the <code>/test</code> page to the <code>FinishedPaying</code> page. It is as so:</p>
  
  <pre><code>class Test extends Component {
    renderRedirect = () =&gt; {
        return &lt;Redirect to="/FinishedPaying" /&gt;;
    };
    componentDidMount() {
      this.renderRedirect();
    }
  ...
  </code></pre>
  
  <p>The following code is meant to send a <code>Paypal</code> transaction, then route the user to the <code>/FinishedPaying</code> page. All of the other logic is working as expected:</p>
  
  <pre><code>export default class Pay extends React.Component {
    state = {
      userInput: ""
    };
    renderRedirect = () =&gt; {
        return (
          &lt;Redirect
            to="/FinishedPaying"
            userInput={this.state.userInput}
          /&gt;
        );
    };
    componentDidMount() {
      this.setState({ userInput: this.props.userInput });
      this.renderRedirect();
    }
  
    render() {
      const onSuccess = payment =&gt; {
        axios
          .post(
            "http://amazonaws.com:3000/ethhash",
            {
              userInput: this.props.userInput,
            }
          )
  
          .then(response =&gt; console.log(response.data, payment))
  
          .catch(function(error) {
            console.log(error);
          });
      };
  
      return (
        &lt;div&gt;
          &lt;PaypalExpressBtn
            onSuccess={onSuccess}
          /&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>Not sure why the second code block is working. It is my understanding that <code>this.renderRedirect()</code> should fire after all of the other logic has happened. It does not seem to be firing at all. Any feedback is appreciated :)</p>