skip to Main Content

Javascript – React circular dependencies w/ useState

I have two useState state values currently, and they rely on each other. Here's some pseudocode: [getId, setId] = useState(); [getSearchParam1, setSearchParam1] = useSearchParams(); useEffect(() => { setId(getSearchParam1) }, [getSearchParam1]) useEffect(() => { setSearchParam1(getId) }, [getId]) where searchParam1 is just…

VIEW QUESTION

Javascript – Uncaught Error: Could not find a matching route when redirecting to /login page after logout

I'm trying to implement JWT in my project and an article provides a nice solution: https://dev.to/sanjayttg/jwt-authentication-in-react-with-react-router-1d03. Routes.jsx import { RouterProvider, createBrowserRouter } from "react-router-dom"; import { useAuth } from "../provider/authProvider"; import { ProtectedRoute } from "./ProtectedRoute"; import Login from "../pages/Login";…

VIEW QUESTION
Back To Top
Search