20,570 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Best practices
0
votes
3
replies
70
views
Source of truth: state (zustand) vs url (react router)
I've got a question!
I have an app where I use Zustand for my state management. For example I have states for the currentProject, current dataset and current view which decides what it shown.
I now ...
Advice
0
votes
2
replies
96
views
useNavigate vs window.location.href( or window.open)
Title
React Router navigate does not work with external URLs
Body
I am working on a project where clicking a lecture card should redirect the user to an external website such as Udemy or Inflearn.
At ...
Advice
2
votes
2
replies
124
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
78
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
61
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
89
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
83
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
252
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
113
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
74
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
339
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
275
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
134
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
143
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 ...