import { BrowserRouter, Routes, Route } from "react-router-dom";
//Layouts
import HomeLayoutRoute from "./components/layouts/HomeLayout";
//components
import Home from './components/Home';
//import Dashboard from './components/Dash';
// Routing
import PrivateRoute from "./components/routing/PrivateRoute";
// Screens
import PrivateScreen from "./components/loginscreens/PrivateScreen";
import LoginScreen from "./components/loginscreens/LoginScreen";
import RegisterScreen from "./components/loginscreens/RegisterScreen";
import ForgotPasswordScreen from "./components/loginscreens/ForgotPasswordScreen";
import ResetPasswordScreen from "./components/loginscreens/ResetPasswordScreen";
const App = () => {
return (
<BrowserRouter>
<div className="app">
<Routes>
<HomeLayoutRoute path="/" element={<Home />} />
<PrivateRoute path="/" element={<PrivateScreen/>} />
<Route path="/login" element={<LoginScreen/>} />
<Route path="/register" element={<RegisterScreen/>} />
<Route path="/forgotpassword" element={<ForgotPasswordScreen/>}/>
<Route path="/passwordreset/:resetToken" element={<ResetPasswordScreen/>}/>
</Routes>
</div>
</BrowserRouter>
);
};
export default App;
这是我的 App.js 文件 这是错误:错误:您无法在另一个 . 你的应用中永远不应该有多个。
此代码适用于 React-Router-Dom 版本 5,但是当我移动到 React-Router-Dom 版本 6 时,出现了这个错误。