20,572 questions
0
votes
2
answers
50
views
How to display <NavLink> components outside MemoryRouter in React Router? [duplicate]
How to display <NavLink> components inside the Footer? I cannot place the Footer inside RouterProvider. The Footer component should be displayed on every page.
function App() {
const router = ...
Advice
1
vote
2
replies
69
views
React Router v7 SPA mode: How to use strict CSP?
I'm migrating an app from React Router v6 + Webpack to React Router v7 (SPA mode) + Vite and I'm having issues with setting a strict Content Security Policy.
In RR6 I had a normal index.html and ...
1
vote
1
answer
56
views
How does it work (internally) when returning Navigate component in React Router v7?
I'm trying to implement a redirect based on a property passed to a component nested deep within my route hierarchy. Right now I know 2 options how to do it.
const MyComponent = ({ variable }: { ...
Tooling
0
votes
3
replies
60
views
React router dom
I want to use react-router-rom and can we still use react-router-dom V5 in today's date? since it support custom route components, while react-router-dom V6+ has strict rules to use Route & Routes....
0
votes
0
answers
19
views
React redirection using auth [duplicate]
I have a app where I am using JWT authentication. When I enter the details and click on the register button, the backend API correctly returns the token but in my console the token stays only for some ...
2
votes
1
answer
84
views
Reuse the same user routes under '/' (UserLayout) and '/admin' (AdminLayout) without duplication
I need to define user pages (Home, Cows, Reports, …) once and make them accessible to AppUser + Admin under "/" with UserLayout, and also accessible to Admin under "/admin/user/*" ...
3
votes
1
answer
80
views
How do I pass data inside fetch function from createBrowserRouter to load content before page has loaded
I'm using react-persist in my application. When I click to add a product to my basket and then want to navigate to my basket page, how do I pass the basket data to the fetch function in the loader ...
1
vote
1
answer
246
views
React Router With Browser Extension Popup Window?
I'm trying to incorporate React Router into my Firefox browser extension to be able to display different pages in the extension's popup window. However, I keep getting the warning, You should call ...
3
votes
1
answer
104
views
React Router Nested Routes
I'm having issues configuring react-router-dom with nested routes loaded by sub-modules.
In my application I need to dynamically load modules that have their own nested routes. One of the requirement ...
0
votes
0
answers
70
views
navigate() in ReactJS shows blank page after routing
The reactJS client has left pane for menu and right for content. The react-route-dom 7.6.3 is used to create route in App.js as below:
const router = createBrowserRouter([
{
path: "/...
4
votes
1
answer
284
views
API route in react-router v7 SPA always throws an error
I currently have a React Router v7 application running in SPA mode. I wanted to make an API route that uses a clientAction to submit data to an endpoint. If I use the useSubmit hook, I can ...
-3
votes
1
answer
235
views
How do I use redux-persist and rtk with React Router v7 Framework (without SSR)? [closed]
I'm trying to migrate an existing React/Vite app (currently using React Router v7, along with redux, rtk-query, and redux-persist) to use React Router v7 in Framework mode. I'm hitting an error when ...
0
votes
1
answer
123
views
Styles not being applied to page using spa mode in build
I have problem with my React app, using Vite and React-Router v7, in framework mode, ssr: false.
When using dev mode, all styles are being applied correctly (I'm using moduled SCSS, and one global app....
2
votes
0
answers
137
views
Preventing race condition between history navigation and route replacement
I'm using React Router v7 with BrowserRouter and need to navigate back multiple steps in browser history, then replace the resulting route atomically. My current approach causes a race condition where ...
1
vote
1
answer
616
views
How to redirect in React Router 7 in Framework mode to another route
I just want to redirect one path to another.
If I have something like this in my routes.ts:
export default [
index("Home.tsx"),
route("/about", "About.tsx"),
] ...