title: React doesn't Redirect properly
body: <p>I'm trying to check a condition and based on that redirect the page to different paths. i'm using following logic:</p>
  
  <pre><code>if (redirectUrl) {
     useEffect(() =&gt; { 
     window.location.replace(redirectUrl!);
     });
  } else {
     return &lt;Redirect to={'/page'} /&gt;;
  }
  </code></pre>
  
  <p>but this logic doesn't work properly. if my url is <code>www.myUrl.com</code> and the redirect is <code>www.redirectUrl.com</code>, this logic redirects me to <code>www.myUrl.com/www.redirectUrl.com</code>...it doesn't remove the first url.
  how can i properly use this? 
  thank you</p>