I finished the React-Router course and am trying to build a custom app with what i learned
the problem is with the requireAuth redirect it is supposed to redirect to login if NOT logged in but i am just getting an error : "import { redirect } from "react-router-dom";
export async function requireAuth() {
const isLoggedIn = false;
if (!isLoggedIn) {
window.location.href = "/login";
}
}
" when i change to window.location.href it does work "import { redirect } from "react-router-dom";
export async function requireAuth() {
const isLoggedIn = false;
if (!isLoggedIn) {
window.location.href = "/login";
}
}"
heres my full code https://codesandbox.io/s/thirsty-colden-hc2dj5?file=/src/App.js