路由,而是重定向到其他路由"/>
在 react chrome 扩展中,它没有打开根路由,而是重定向到其他路由
我使用 vite react 创建了这个 react chrome 扩展,当我打开扩展时,它会将我重定向到登录路径,如果我删除登录路径,它会打开空白页面,根 div 中没有任何元素。它应该首先呈现 GetStarted 页面。这是我的 App.jsx 代码:
import { Routes, Route, useLocation } from "react-router-dom";
import { AnimatePresence } from "framer-motion";
import Auth from "./screens/Auth";
import CreateAccount from "./screens/CreateAccount";
import CreateUsername from "./screens/CreateUsername";
import Dashboard from "./screens/Dashboard";
import GetStarted from "./screens/GetStarted";
import Login from "./screens/Login";
import SeedPharse from "./screens/SeedPharse";
import Transaction from "./screens/Transaction";
import VerifyEmail from "./screens/VerifyEmail";
function App() {
const location = useLocation();
return (
<div className="pb-5">
<AnimatePresence mode="wait">
<Routes location={location} key={location.key}>
<Route exact path="/" element={<GetStarted />} />
<Route exact path="/auth" element={<Auth />} />
<Route exact path="/register" element={<CreateAccount />} />
<Route exact path="/createUsername" element={<CreateUsername />} />
<Route exact path="/verify" element={<VerifyEmail />} />
<Route exact path="/dashboard" element={<Dashboard />} />
<Route exact path="/seedPharse" element={<SeedPharse />} />
<Route exact path="/transaction" element={<Transaction />} />
<Route exact path="/login" element={<Login />} />
</Routes>
</AnimatePresence>
</div>
);
}
export default App;
回答如下:
更多推荐
在 react chrome 扩展中,它没有打开根路由,而是重定向到其他路由
发布评论