Hashrouter and AEM as Cloud | Community
Skip to main content
jezwn
Level 5
April 25, 2024
Question

Hashrouter and AEM as Cloud

  • April 25, 2024
  • 1 reply
  • 474 views

I've built a react dashboard, which is deployed to AEM. I'm using hashrouter in the react app. Everything works fine in local. But upon deploying to cloud, I noted that AEM as Cloud also uses the hashrouter and routes doesn't work. I need to use hashrouter for some reasons. How to make both these work?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

gkalyan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 28, 2024

@jezwn 

Using HashRouter in a React app deployed on AEM as Cloud can cause conflicts, as AEM itself uses HashRouter for its routing. To resolve this issue, you can try using BrowserRouter instead of HashRouter in your React app.

 

BrowserRouter uses the HTML5 history API to keep the UI in sync with the URL. So, it provides a better user experience.