D
D
Dmitry Maksimyuk2021-03-28 13:23:41
React
Dmitry Maksimyuk, 2021-03-28 13:23:41

Why does URL change, React Router?

There is such a link: name.github.io/example, example is removed when entering the site, that is, from this one:
name.github.io/example
It turns into this:
name.github.io
I need what would happen when the page is refreshed was name.github.io/example.
Here is an example: an example , I went to the site: domen/taskreactive/, and when the page is updated, there is no page, because /taskreactive/ disappears
. problem?

router:

// импорты
  import {
    Route,
    BrowserRouter as Router,
    Switch
  } from 'react-router-dom';

// разметка
     <Router>
        <div style={{ display: "flex", justifyContent: "center" }}>
          <PageHeader />
            <Switch>
              <Route path="/profile">
                <Profile />
              </Route>
              <Route path="/">
                <NewUser />
                <Home />
              </Route>
            </Switch>
          </div>
        </div>
      </Router>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2021-03-28
@dimka222

https://muffinman.io/blog/react-router-subfolder-o...
As far as I remember githab pages allow you to create a subdomain for a subfolder in the repository, by right clicking on it. Perhaps this solution will be simpler than the one described above

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question