I am making my first mern app and working on the login and registration part and I am stuck on a problem , the problem is that I made a verification route which pops up when someone registers but I want that no one should be able to go there via changing the URL, I know the concept of private routes but I don't know how to apply it here I mean what condition can I give to stop user to go there , I want that no one should be able to go there until they register.
Routes code:-
import Navbar from "./components/navbar/Navbar";
import Home from "./components/Home/Home";
import 'bootstrap/dist/css/bootstrap.min.css'
import Forgot_password from "./components/login_and_reg/Forgot_password/Forgot_password";
import Weather from "./components/Weather/Weather";
import Landing_page from './components/login_and_reg/Landing_page/Landing_page'
import {
BrowserRouter as Router,
Route,
Routes,
Navigate
} from "react-router-dom";
import Verification from "./components/login_and_reg/Verification/Verification";
import Protected_routes from './components/Protected_routes'
import Protected_routes_2 from "./components/Protected_routes_2";
import { useSelector } from "react-redux";
function App() {
const isloggedin = sessionStorage.getItem('isloggedin');
const rememberMe = localStorage.getItem('rememberMe')
return (
<>
<Router>
{/* <Navbar/> */}
<Routes>
<Route path="/weather" element={
<Protected_routes_2>
<Weather/>
</Protected_routes_2>}></Route>
<Route exact path="/" element={<Protected_routes/>}></Route>
<Route path="/verify/:first_name/:email" element={<Verification/>}></Route>
<Route path="/forgot_password" element={<Forgot_password/>}></Route>
{/* <Route exact path="/home" element={<Protected_routes/>}></Route> */}
</Routes>
</Router>
</>
);
}
export default App;