D
D
dfv1232017-05-03 03:47:14
GitHub
dfv123, 2017-05-03 03:47:14

Why is simple application routing not working on github pages?

Repository https://github.com/wsavd/joonline (in the master branch) with an example of page routing from off. documentation
By the local machine everything works, I fill in on gh-pages - a white background.
Here is the uploaded application https://wsavd.github.io/joonline

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Gushchin, 2017-05-03
@dfv123

Because the routes are not suitable. Do you have :

<Router>
    <App>
      <Route exact path="/" component={Home}/>
      <Route path="/item0" component={Item0}/>
      <Route path="/item1" component={Item1}/>
    </App>  
  </Router>,

And on GH pages your route is /joonline/ . Fortunately, there is a simple solution - specify the basepath ( documentation ) against which all application routes will be built:
<Router  basename="/joonline"/>
    <App>
      <Route exact path="/" component={Home}/>
      <Route path="/item0" component={Item0}/>
      <Route path="/item1" component={Item1}/>
    </App>  
  </Router>,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question