title: How to prevent react-router from refreshing page?
body: <p><strong>What's the problem?</strong></p>
  <p>I am building a project in reactJs with react-router-dom v5. I have added a default route to routing</p>
  <blockquote>
  <p>&lt;Redirect to={&quot;someComponent&quot;}/&gt;</p>
  </blockquote>
  <p>Now the problem is that a simple refresh also redirects me to the default route. How to prevent that?</p>
  <p>Code snippet:
  App.js</p>
  <pre><code>return (
        &lt;div className=&quot;App&quot;&gt;
              &lt;Switch&gt;
                 &lt;div id=&quot;wrapper&quot; className=&quot;main_page&quot;&gt;
                   &lt;ErrorBoundary resetState={state}&gt;
                    &lt;Header/&gt;
                      &lt;/ErrorBoundary&gt;
                        &lt;div id=&quot;page-wrapper&quot; className=&quot;mainContentArea&quot;&gt;
                          &lt;Route path={`/dashboard/units`} component={Dashboard} /&gt;
                            &lt;ErrorBoundary resetState={state}&gt;
                              &lt;Suspense fallback={&lt;div&gt;Loading..&lt;/div&gt;}&gt;
                                &lt;Route path={`/dashboard/someRoute`} component={someComponent} /&gt;
                              &lt;/Suspense&gt;
                            &lt;/ErrorBoundary&gt;
                          &lt;Redirect to={&quot;someComponent&quot;}/&gt;
                  
                       &lt;/div&gt;
                  &lt;/div&gt;
             &lt;/Switch&gt;
        &lt;/div&gt;
      );
  </code></pre>
  <p>Can someone help me with the above problem? Due to Redirect in App.js, I am redirected to dashboard even with a simple refresh</p>
  <p>Edit:I have Router and BrowserRouter in a separate component.This is just a snippet</p>