我不知道为什么会发生这种情况,但它说没有与位置“/”匹配的路线。从头文件中可以看出,该 url 中有 home 组件。
为了更好地理解,这里是存储库: https://github.com/MohdZaid259/MegaBlog.git
您是否尝试过在
index
中添加 <Route />
属性?
<Route index element={<Home />} />
https://github.com/remix-run/react-router/blob/dev/examples/basic/src/App.tsx#L19-L22