S
S
Swaer2018-11-21 23:33:16
JavaScript
Swaer, 2018-11-21 23:33:16

Components do not work at startup, how to fix it?

file:///D:/aa/dist/index.html I run the file, the green background appears, and my components in the route do not work, although everything works as it should in localhost: 8080 , what could be the reason?

<div className="game">
      <Switch>
        <Route exact path="/" component={Start} />
        <Route path="/game" component={Game} />
        <Route path="/finish" component={Finish} />
      </Switch>
    </div>

the div with the class is shown, but inside it is empty

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-11-21
@Swaer

The file url protocol does not have a sub-path in the file. You cannot write D:\Dir\file.txt\ahaha\ in Windows, so routing cannot work there, except perhaps based on location.hash

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question