All Questions
7,482 questions
-3
votes
0
answers
39
views
My navigation bar menu is not active again after navigating to a page
Whenever I navigate to the Contact us page or About us page, I cannot navigate to another page again from that page unless I reload the app or go back to the homepage.
I notice it happened when I was ...
1
vote
1
answer
77
views
How to set basename for react-router v7 framework mode?
I have created a React-Router framework mode app like this:
npx create-react-router@latest my-react-router-app
The version of React-Router is:
"react-router": "^7.5.1"
In routes....
-1
votes
0
answers
33
views
how to use hooks like useLocation with @react-router/fs-routes [closed]
I have a react app using react-router / nx / vite. When I setup the project, I choose ssr: true, and I now have the following
react-router.config.ts
import type { Config } from "@react-router/dev/...
2
votes
1
answer
67
views
I cannot figure out why ProtectedRoute wont re-render after updating useState
I would like the ProtectedRoute to call server and get a response that indicates whether the user is logged in or not, on every render of a page that it protects. The server is sent a session cookie ...
0
votes
0
answers
21
views
Route Transition Flickering in React Router Framework v7 (Private Routing) [duplicate]
I'm currently developing a project utilizing React Router v7 framework where I need to implement protected routes. While I've successfully implemented the protection mechanism, I'm encountering an ...
-1
votes
1
answer
50
views
How come visiting child component loses functionality?
I have an app that has a 3 JSX files:
one for controlling states
import React from "react";
import CreateRisk from "./CreateRisk";
import TablePage from "./TablePage";
...
-1
votes
1
answer
94
views
react component is not displayed with react router v7
I do
function PrivateRoutes() {
const user = useAuth();
return user.token ? <Outlet /> : <Navigate to="/login" replace />;
}
const routes = (isInstalled: boolean) => [
...
1
vote
1
answer
36
views
Redirect when path parameter is not provided in react-router-dom
I have the following routes defined in react-router-dom
<Route id='editor' path='editor' >
<Route index element={<Editor />} />
<Route id='edit' path='edit/:documentId' ...
1
vote
1
answer
65
views
React Routes Question about routes with same path and components
In my React code I have these 2 files in App.js and Users.js. By using Routes just for fun and experimenting to render some random text, I have 3 routes that have the same path and components but ...
-4
votes
1
answer
102
views
createMemoryRouter throws TypeError: Cannot destructure property 'basename' of 'React10.useContext(...)' as it is null [closed]
Using createMemoryRouter to create router to render doesn't work. It renders and error page.
import { vi, describe, it, expect } from 'vitest'
import { render } from '@testing-library/react'
import { ...
-1
votes
1
answer
218
views
How to integrate MUI Toolpad's PageContainer with a custom Sidebar?
Material UI has a component called PageContainer which provides a title and breadcrumb navigation as shown here:
https://mui.com/toolpad/core/react-page-container/
I want to navigate to the same place ...
1
vote
2
answers
153
views
I'm using React Router v7.20 and getting this error in my Account.jsx component [closed]
The error happens when I refresh the page or navigate between "/account", "/account/bookings", and "/account/places".
import React, { useContext } from 'react';
import { ...
0
votes
1
answer
260
views
React Router v7 splats paths migration issue
I'm trying to create a scenario for migration of React-Router from version 6 to version 7.
I have followed the migration steps of the documentation but the routing is not working.
I'm stuck and can't ...
-1
votes
1
answer
46
views
How can I prevent my list component from remounting when using modal routes with HashRouter in React Router v5?
I’m adjusting some functionality for a React app (using React 16.13.1) with React Router v5 and HashRouter. My app displays a list of coupons in a table (using AgGrid) within a component (named ...
1
vote
1
answer
55
views
Why can’t I use <GameRoutes /> as a component inside <Routes> in React Router?
I am currently creating a routes folder to better organize my project as it grows.
I created a file named GameRoutes.jsx, but when I import and use it in my App.jsx, I cannot use it as a component <...