Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Hashrouter and AEM as Cloud

Avatar

Level 6

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Community Advisor

@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.