Introduction
In recent years, front-end frameworks have been flourishing, and many beginners who have just learned JavaScript have directly learned the three major frameworks (although React is not a framework, the entire ecosystem is actually no different from the framework, so I think it can be classified as a framework).
These three major frameworks are usually used to write SPA (Single Page Application). I have always believed that some basic knowledge should be possessed before learning these frameworks, especially the understanding of front-end and back-end. Otherwise, you will definitely encounter many problems that you don’t know where to start.
Therefore, this article uses a problem that I have encountered myself and that students often come to ask me as an example. You can also think about whether you can answer this question:
Suppose I have an SPA, using a library of some routers to implement routing, so
/list
will go to the list page, and/about
will go to the about me page.But strange, when I uploaded the SPA to GitHub Pages, the homepage is good, and when I go to
/list
from the homepage, it is also good, but when I refresh/list
, it shows 404 not found. Why is this?
To answer this question, you must first review some basic knowledge related to front-end and back-end networks.