看了你的文章,react也沒學多久,目前我請教一個問題。按照你的方式實現(xiàn)了兩個入口頁面,但是為什么用BrowserRouter找不到頁面了?以下就是入口文件代碼。router更新到最新的,所以有些api不一樣,可忽略;用 HashRouter,訪問地址這樣:http://localhost:3000/portal.html#/about,http://localhost:3000/admin.html#/use,history路由 http://localhost:3000/portal.html 這樣就訪問不到了
<HashRouter>
<Routes>
<Route path="/" element={<Layout />}>
<Route path="about" element={<About />} />
<Route path="product" element={<Product />} />
{/* <Route path="teams" element={<Teams />}>
<Route path=":teamId" element={<Team />} />
<Route path="new" element={<NewTeamForm />} />
<Route index element={<LeagueStandings />} />
</Route> */}
</Route>
</Routes>
</HashRouter>
React工程如何實現(xiàn)多入口多SPA?大家入門react想必都是從這行命令開始的吧! 這個命令會生成一個工程骨架,小伙伴就可以愉快的板磚了。搬久了發(fā)現(xiàn)工程越來越大,一打包好幾兆,嚴重影響加載速度。這時候就需要多入...