All Questions
432 questions
1
vote
1
answer
54
views
Is there a way to dispatch a function with react router and Redux?
I have the following routes:
const routes = createBrowserRouter([
{
path: '/',
element: <Root />,
children: [
{ index: true, element: <Home /> },
{ path: 'new', ...
0
votes
1
answer
544
views
Using Redux with React-Router-DOM Data Routers
Could I use Redux with routers in the following way? Also is there a reason to use it this way instead of using the router module's hooks?
import { createBrowserRouter, RouterProvider } from "...
1
vote
1
answer
67
views
React Router Redirect Issue When Clicking Links
I'm encountering a problem with React Router where I have a header component and a home component, and I want to navigate to a movie detail page when a movie is clicked. The issue is that when I'm ...
1
vote
1
answer
862
views
How to pass props to children class components in react router v6 without using <Outlet />?
I've been migrating React Router from v3 to v6 in a project and things got messy since I have some React function components and some React class component which I want to keep them as classes for ...
0
votes
0
answers
53
views
React Page contents are not rendering in React (With Redux) without a manual refresh
I am new to React and currently doing a demo project in React - with Redux. I have designed a Homepage, But it's contents are not rendering on initial loading. The contents are loading perfectly after ...
1
vote
0
answers
17
views
Undefined 'pathname' issue with connected-react-router [duplicate]
I have a fairly simple React app that I'm having issues getting to work after adding connected-react-router. None of the pages will load and it immediately throws this error: Uncaught TypeError: ...
-1
votes
1
answer
66
views
react-router Link changing route prior to redux state updates?
I have 2 pages A and B. There is a link on B that leads to A via a react-router Link.
B -> click Link to A -> A
B dispatches a redux action on componentWillUnmount that updates some state that ...
0
votes
1
answer
41
views
Tips for displaying components based on global state
I'm build game interface that has the following user flow:
user lands on one of the games URL eg. www.name.com/game1, first gets intro screen, than game screen and finally fail or success screen.
I'm ...
2
votes
1
answer
718
views
How to push to History in React Router v6? I face with not found message
I used react@18, redux, and react-router@6. I have a button add to cart on my product page and I want the product to be added to local storage and I have that product on my Cart page. After clicking ...
1
vote
1
answer
3k
views
Uncaught TypeError: Cannot read properties of undefined (reading 'map') React
So im following this tutorial and im struggling with the following step. Redux was introduced and it not working. I googled the error that I found in the developer Tool and I still couldn't fix the ...
3
votes
1
answer
2k
views
react-router does not navigate to desired the route after an async operation
I was working on a project when it turned out that when I dispatched an action and tried to navigate to the /home route after making an async call to my api and using the await keyword to wait for my ...
1
vote
1
answer
3k
views
useSelector only fires correctly after re-render in Redux store, React router
i have a situation with two pages. The first one is the main page, the right one is rendered accordingly. The right component gets rendered depending on the redux state and basically works correctly.
...
3
votes
0
answers
37
views
React PrivateRoute Redirect too fast [duplicate]
When user log in to the application everything is fine, but after reloading the application user is not yet authenticated and it redirect to /login page too fast.
Let me show you the code:
Redux
const ...
0
votes
1
answer
37
views
How to stop React to rerender when I switch to other url from project
I build a project in React using Redux and Router and I have a little question. If I navigate between project pages by clicking buttons, my state from Redux is not deleted.
But if I try to write the ...
3
votes
1
answer
3k
views
React Router v2.7 to v6 onEnter Migration
I am trying to migrate an application running on router v3, using the onEnter attribute for route after auth.
onEnter function in YAMain.jsx
static onEnter(store) {
return (nextState, ...