在早些时候与BrowserRouter的版本中,我可以把路线与亲密的主人混为一谈,并允许进行撤离。
但现在却在创造。 BrowserRouter公司因囚犯而造成错误 驻留不是一个路由部分。 是否有办法这样做?
const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<RootLayout />}>
<Route index element={<Main />} />
<Route path="about" element={<About />} />
<Route path="projects" element={<Projects />} />
<Route path="contact" element={<Contact />} />
</Route>
)
);
function App() {
return <RouterProvider router={router} />;
}
I tried to use it around the <Outlet />
components and it bugged.
I tried to use it around the <RouterProvider />
and also got an error.
I tried to only use animatePresence and useLocation on the motion div and did not work either.