All Questions
441 questions
1
vote
1
answer
121
views
Redux Toolkit store resets when navigating via URL input, but works fine with React Router navigation
I'm facing an issue with Redux Toolkit where the store resets back to its initial state when I manually type a URL in the browser's address bar (e.g., /admin). However, if I navigate between pages ...
-1
votes
2
answers
49
views
Dispatch posts again and again to my redux state
I am working on a project which have multiple routes like /profile /admin /home
I am fetching posts from backend using Redux Toolkit query in profile page and getting posts successfully but when I go ...
0
votes
1
answer
1k
views
RTK query API not updating state immidiately
I am trying to build an app with JWT authentication, express as its backend and react as its frontend. Used react-router for frontend routing. What I am trying to do is, verify token of JWT and if the ...
1
vote
1
answer
837
views
User not being updated as I login using protected route in react route v6
I am trying to log a user in. I have a login component which takes the credentials and then I am using redux toolkit to store the state and the verification and everything is done in userSlice. I have ...
1
vote
1
answer
97
views
Changing React navbar component with redux data
So basically here I want my navbar routes to change along with login info from the redux reducer, but the routes stay static.
useEffect(() => {
getUserInfo();
console.log(props.userInfo?. ...
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
votes
1
answer
61
views
can any one help me fix this react problem
error am getting now
This is the index.js file
import React from 'react';
import ReactDOM from 'react-dom/client';
import 'bootstrap/dist/css/bootstrap.min.css'
import './index.css';
import App from '....
0
votes
1
answer
397
views
useNavigate won't work after removing JWT from localstorage
The goal is to basically "logout", which means removing the JWT that's currently stored in local storage.
Ideally, what I want is that the logout button is clicked, the logout function is ...
1
vote
2
answers
843
views
Uncaught TypeError: Cannot read properties of undefined (reading '0') after refresh
I have a weird probleme here, so i am working with redux and this is my component code for a selected product from reducer state.
import './productInfo.css';
import { useParams } from 'react-router-...
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 ...
3
votes
2
answers
342
views
Page crashes(reading properties of undefined) in React.js
In my project I'm using redux toolkit and react router v6. I have invoices list with 'View' button and when it's clicked it should open page with description about invoice. Also i have add invoice ...
1
vote
0
answers
33
views
react router v6 always redirecting to home on refresh [duplicate]
I've set up protected routes, firebase login functionality, and a redux store for the login state on my app and I've been trying to set the app up so I can refresh any page and it will stay on that ...
-1
votes
1
answer
113
views
React State update with button click from another component
Please read the details below of code
enter image description here
This MegaMenu Component
import MenuIcon from '@mui/icons-material/Menu';
import './MegaMenu.css';
import { NavLink } from 'react-...
1
vote
1
answer
2k
views
State from redux store gets lost/ reset when changing route
I have a simple app that so far only has a main login component, and a home page with a navbar which the user is supposed to be routed to once they login to the app. The user experience should be as ...