<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Using existing React app with Liferay 7.2 - Routing issue</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119399536" />
  <subtitle>Using existing React app with Liferay 7.2 - Routing issue</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119399536</id>
  <updated>2026-04-06T05:17:24Z</updated>
  <dc:date>2026-04-06T05:17:24Z</dc:date>
  <entry>
    <title>RE: Using existing React app with Liferay 7.2 - Routing issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119403999" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119403999</id>
    <updated>2020-06-15T22:46:32Z</updated>
    <published>2020-06-15T22:46:32Z</published>
    <summary type="html">Sorry, didn&amp;#39;t see this sooner...&lt;br /&gt;&lt;br /&gt;You can&amp;#39;t really rely on anything that is address-bar related. Unlike most react apps where they own the address bar, as portlets they can never own the address bar as that is owned and operated by the portal.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2020-06-15T22:46:32Z</dc:date>
  </entry>
  <entry>
    <title>RE: Using existing React app with Liferay 7.2 - Routing issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119403646" />
    <author>
      <name>Chris Goad</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119403646</id>
    <updated>2020-06-15T22:00:02Z</updated>
    <published>2020-06-15T22:00:02Z</published>
    <summary type="html">I believe I figured out the solution.  Instead of the following line:&lt;br /&gt;import { BrowserRouter as Router, Switch, Route } from &amp;#39;react-router-dom&amp;#39;;&lt;br /&gt;&lt;br /&gt;it should be &lt;br /&gt;import { HashRouter as Router, Switch, Route } from &amp;#39;react-router-dom&amp;#39;;&lt;br /&gt;&lt;br /&gt;It must be HashRouter for Portlets&lt;br /&gt;&lt;br /&gt;Chris</summary>
    <dc:creator>Chris Goad</dc:creator>
    <dc:date>2020-06-15T22:00:02Z</dc:date>
  </entry>
  <entry>
    <title>Using existing React app with Liferay 7.2 - Routing issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119399535" />
    <author>
      <name>Chris Goad</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119399535</id>
    <updated>2020-06-15T17:57:48Z</updated>
    <published>2020-06-15T17:57:48Z</published>
    <summary type="html">I apologize if this has been asked, but I didn&amp;#39;t see anything that was a direct answer to this.  I&amp;#39;ve migrated a simple React application to Liferay using &lt;a href="https://help.liferay.com/hc/en-us/articles/360035467712-Adapting-Existing-Apps-to-Run-on-Liferay-DXP"&gt;https://help.liferay.com/hc/en-us/articles/360035467712-Adapting-Existing-Apps-to-Run-on-Liferay-DXP&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;My question:  Is there a solution that works for consistent routing?  I&amp;#39;ve tried both Reach router and React router.  Sometimes, it works as expected, but then I&amp;#39;ll try it and I get &amp;#34;The requested resource could not be found.&amp;#34; when I click on one of my navigation links.I saw a couple of examples and a Youtube video where someone has routing that was working, but I am wondering what I am doing wrong.  &lt;br /&gt;My routing is simple:&lt;br /&gt;app.js&lt;br /&gt;import React from &amp;#39;react&amp;#39;;import Home from &amp;#39;./Home&amp;#39;;import Second from &amp;#39;./Second&amp;#39;;import { BrowserRouter as Router, Switch, Route } from &amp;#39;react-router-dom&amp;#39;;import Nav from &amp;#39;./Nav&amp;#39;;&lt;br /&gt;function App() {  return (    &amp;lt;&amp;gt;      &amp;lt;Router&amp;gt;      &amp;lt;Nav /&amp;gt;        &amp;lt;Switch&amp;gt;          &amp;lt;Route exact path=&amp;#39;/&amp;#39;&amp;gt;            &amp;lt;Home /&amp;gt;          &amp;lt;/Route&amp;gt;          &amp;lt;Route exact path=&amp;#39;/second&amp;#39;&amp;gt;            &amp;lt;Second /&amp;gt;          &amp;lt;/Route&amp;gt;        &amp;lt;/Switch&amp;gt;      &amp;lt;/Router&amp;gt;    &amp;lt;/&amp;gt;  );}&lt;br /&gt;and Nav.js:import React from &amp;#39;react&amp;#39;;import {  Link } from &amp;#39;react-router-dom&amp;#39;;&lt;br /&gt;export default function Nav(){    return(        &amp;lt;nav&amp;gt;            &amp;lt;Link to=&amp;#34;/&amp;#34;&amp;gt;Home&amp;lt;/Link&amp;gt;{ &amp;#39; | &amp;#39; }            &amp;lt;Link to=&amp;#34;/second&amp;#34;&amp;gt;Second&amp;lt;/Link&amp;gt;        &amp;lt;/nav&amp;gt;    );}Any help would be appreciated.  Thank you&lt;br /&gt;Chris</summary>
    <dc:creator>Chris Goad</dc:creator>
    <dc:date>2020-06-15T17:57:48Z</dc:date>
  </entry>
</feed>
