Search code examples
javascriptreactjsreact-boilerplate

React boilerplate page is reloading on route


I am using react boilerplate for my app and it is behaving very strange. I have multiple pages and some pages are working fine and on some pages my app is reloading means its refresh the page.

E.g on

www.myapp.com/login its working fine as a single page.

Network Calls

but on www.myapp.com/about its reload the whole page just like I am opening home page very first time.

Network calls

Did not understand why this is happening.

FYI: React boilerplate is using Suspense and Lazy to load the component.

Any help would be appreciated.


Solution

  • This might be issue with routing.

    In case of www.myapp.com/login you might have used some routing package (react-router) and added specific route, component to load and used a <Link to="/login" >Login</Link> component to route to /login page.

    Where as for www.myapp.com/about page, instead of using a <Link to="/about">About</Link> to route to /about, you might be doing <a href="/about">About</a> which causes reload of the webpage.