score:0

are you using react router? having more info on your routing code and lib, or a link to your code would greatly help.

if you are indeed using react router, i believe the basename property would help.

  <browserrouter basename="react-app-name">
    <routes>
      <route path="/" element={<app />}>
        <route path="users" element={<users />} />
      </route>
    </routes>
  </browserrouter>

score:0

if i understand your question correctly, you might have missed setting the homepage property properly in your package.json file.

here is how to do so:

  1. open your package.json file.
  2. at the top level, give the homepage of your app in this format: https://<gitname>.github.io/<repo-name>.

here is an example:

{
  "name": "react-app",
  "version": "0.1.0",
  "homepage": "https://gitname.github.io/react-app-name",
  ....

your react app will be deployed at /react-app-name.

to learn more about how to deploy a react app to github pages, read this.

if that was indeed done correctly, you might want to look into specifying the basename prop in browserrouter that provides a base url path for all the locations in the application (as suggested in ivanosevitch's answer).


if none of the above solves the issue, please elaborate on your problem so it is easier to understand where it is stemming from.


Related Query

More Query from same tag