score:1

the problem is how you include the scripts in your html, not anything js or react related.

your script source is relative - ./path-to-script; this makes it dependent on the url. so from page domain.com/examplea the path to script is domain.com/path-to-script, but as soon as you add another level in the url, or even just a slash, the relative path changes. for example, domain.com/examplea/ produces the path domain.com/examplea/path-to-script.

you should instead use an absolute path. simply removing the . at the beginning is enough for most cases. starting the source path with a / implies that its at the root level of the domain. so a source at /path-to-source will always yield domain.com/path-to-script no matter what the url is.

so for your use case, it appears your scripts need to be changed to

<script src="/covid19/static/js/2.8cd0c9f0.chunk.js"></script>
<script src="/covid19/static/js/main.05f82414.chunk.js"></script>

Related Query

More Query from same tag