Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [react-router-dom]

Use this tag for questions regarding DOM use and bindings of React Router v4, v5, and v6.

react-router-dom
1 vote
1 answer
14 views

When to use <Link to="" /> from react-router-dom and anchor tag? (React Router Dom Version 6.24.1)

I have a React 18 application and I am using the react-router-dom version 6.24.1. I am getting confused as to when I should use the <Link /> tag and when I should use the <a> (anchor) tag ...
qqq's user avatar
  • 866
0 votes
0 answers
18 views

React useNavigate does not navigate me to the correct page, even though the URL is correct

Here is my WEbSocketListener.jsx. My component get the data.orderId correctly because the URL changes, then I call navigate but for some reason it does not work. When I refresh my page the desired ...
Balázs Patai's user avatar
-1 votes
0 answers
26 views

React router installtion [duplicate]

[enter image description here](https://i.sstatic.net/YFrlUbTx.png) I am trying to install react router dom by writing 'npm i react-router-dom' in terminal but it is constantly showing this error. Can ...
Naiba Batool's user avatar
-2 votes
0 answers
49 views

Why I am getting this "No overload matches this call" error? [closed]

This is my Routes Config file import React, { lazy, Suspense } from "react"; import { Routes, Route, Navigate } from "react-router-dom"; import { ROUTES } from "../constants/...
Prashant Lalwani's user avatar
1 vote
0 answers
38 views

How can you conditionally render components on a page and use routing together? [closed]

I took a previously working page that conditionally rendered components and tried to add routing via react-routerv6. It's neither updating the URI nor the page when I try to change the ...
T rumsey's user avatar
-1 votes
0 answers
30 views

fallback element not coming when lazy prop is used - ReactRouterV6

I am using ReactRouterV6 to lazy load a router, When I use lazy prop, in this case my fallback element defined in RouterProvider not coming up. When Fallback UI Shows UP Fallback Element only comes ...
Rahul's user avatar
  • 5,762
1 vote
2 answers
33 views

How to prevent scroll-to-top on certain links in React-Router with a custom ScrollToTop component

I'm using React-Router with a custom ScrollToTop component to reset the scroll position to the top of the page on navigation. However, I have a specific use case where I need the scroll position to ...
Andrian's user avatar
  • 41
-3 votes
0 answers
33 views

React router not running [closed]

in this code my first component is running correctly but the second one (ProuductList) is not showing up on the screen at all, any ideas? import { Route, Routes } from "react-router-dom"; ...
Mahshid Jafarzadeh's user avatar
0 votes
1 answer
27 views

I'm trying to open a component from header. I tried Routes. When I click on the linked icon, it adds /componentName to local host and nothing happens [duplicate]

App.js import Heading from './Components.js/Heading.js' import './App.css' function App () { return ( <div> <Heading /> </div> ); } export default App index.js ...
O_thie's user avatar
  • 1
1 vote
0 answers
31 views

Issue with useNavigate and useBlocker in createBrowserRouter Setup [duplicate]

App.tsx const createRouter = (user: User | null, isChair: boolean) => createBrowserRouter([ { path: pagePaths.home, element: user === null ? <Login /> : isChair ? <...
jungmin's user avatar
  • 45
1 vote
2 answers
47 views

useLocation Hook Error: "useLocation() may be used only in the context of a <Router> component" in React Application [duplicate]

I'm developing a React application and I'm encountering an error when using the useLocation hook from the react-router-dom library. The error message I receive is: Error: useLocation() may be used ...
Aaron Tauro's user avatar
-1 votes
0 answers
39 views

Trying to Implement Authorization Routes in React using react-router-dom v6

I am trying to implement a protected route system through the use of a context that holds the data to be kept in mind in order to give access to said routes. The way I am checking these files ...
yzkael's user avatar
  • 67
0 votes
1 answer
41 views

Url is changing but page is only appearing after reloading [duplicate]

import React from 'react'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import Onboarding from './components/Onboarding/Onboarding'; import Login from './components/Login/...
Radhesh Pandey's user avatar
0 votes
0 answers
19 views

React useState hook is not updated [duplicate]

When I run my frontend and backend, Axios makes a request to the specified route and logs the status of the response as '200' to the console. However, even after that, the 'auth' state does not update....
Pratham Porwal's user avatar
-1 votes
0 answers
29 views

How to enable react client side routing with nextjs static export SPA?

I have built a single-page app using Nextjs and it is exported as a simple static page which means no server-side rendering or Node.js backend, so everything runs on the client side as soon as the ...
mehran's user avatar
  • 1,366

15 30 50 per page
1
2 3 4 5
521