How to make single page app in sub folder?

Please provide the following:

  1. SDK Version: 48
  2. Platforms(Android/iOS/web/all): web
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m creating a react native web app. Following instructions I set homepage inside package.json to point to a subfolder.
Then I deploy the build files into a subfolder. It works. However, whenever I navigate to another screen, the url changes. I want to it to keep the url when navigating like a single page app. Is this possible?

Yes, it’s possible to create a single-page app in a subfolder using React Native Web and maintain clean URLs during navigation. Follow these steps: Set homepage in package.json to the subfolder path. Configure BrowserRouter in your main app entry point with basename. Use react-router-dom for navigation within your app. Build and deploy your app to the subfolder on your web server. By doing this, you’ll achieve single-page app behavior with clean URLs during navigation. screen mirroring

This behavior keeps the app feeling like a single-page app, even though you have multiple screens. By using React Router’s component or its programmatic navigation functions like history.push(), you can achieve seamless navigation while preserving the URL. You can visit official site.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.