Some weeks ago I have been trying to integrate a simple single page application (SPA) based on react within drupal. Some more details can be foun in this thread.
I have successfully started an application within drupal, now my problem is shifted to another level, that is Routing
. I can navigate within the SPA correctly but I cannot interact through the addressbar of the browser, neither the url changes as the content within the spa change. Finally, the back, forward buttons of the browser leave spa page completely
I can imagine that it might be possible to change the address bar url as i navigate within the SPA, (something like http://localhost:8080/node/spa#/path/to/page1 etc.) but i cannot find any relevant tutorial or guide; or to know that is impossible to do such a thing and re evaluate my solution
After doing some trial and error, one way to go properly with the routing of an spa that lives within the drupal CMS is with hashtags, given the fact/limitation that no other component is using the hashtag as a way to do construct urls (e.g. by the theme)
so the URL of the page will have two parts while being in the SPA page:
http://drupal/url/to/page#/spa.part
In this way both drupal and spa work together.