react-router Questions
15
Solved
I'm looking for a way to modify the page title when React-Router v4+ changes locations. I used to listen for a location change action in Redux and check that route against a metaData object.
When ...
Alexandra asked 21/9, 2018 at 16:30
8
Solved
I have this error when I try to import useRouteMatch from react-router-dom module, I have this error :
Attempted import error: 'useRouteMatch' is not exported from
'react-router-dom'.
do I ha...
Rourke asked 15/10, 2019 at 17:29
50
Solved
With react-router I can use the Link element to create links which are natively handled by react router.
I see internally it calls this.context.transitionTo(...).
I want to do a navigation. Not ...
Nisus asked 26/6, 2015 at 17:38
6
I’m trying to implement basic routing for my application but got stuck with the difference between the BrowserRouter and Router. In my case Router is working properly, BrowserRouter is not routing ...
Strikebreaker asked 26/6, 2019 at 3:17
11
Solved
I'm using react-router, so I use the <Link /> component for my links throughout the app, in some cases I need to dynamically generate the link based on user input, so I need something like wi...
Feller asked 21/7, 2015 at 12:41
4
I need to run the server like I simply do with:
npm run start
but I need to use the production mode. Is this possible?
In ember or angular it is possible. How to do in create-react-app?
I tried...
Lyophilic asked 17/3, 2018 at 19:31
5
Solved
I want to lazy load my components to decrease my initial bundle size and get components on the fly using code splitting using react router.
However, when using React Suspense, they force you to use...
Kayleigh asked 27/8, 2020 at 22:27
3
On this repo: https://github.com/tlg-265/react-app-vanilla
$ git clone https://github.com/tlg-265/react-app-vanilla
$ cd react-app-vanilla
$ yarn
$ yarn start
I have a dummy app with just 3 pages:...
Ballroom asked 24/8, 2021 at 7:8
5
With react router I have done this up update the url:
this.props.history.push({
pathname: `/product/${this.props.product.id}`,
});
However this causes a re-render/navigation change. Is there a wa...
Abattoir asked 18/7, 2019 at 19:58
5
Solved
I want to origin url path without router params.
// routers
<Route
exact
path={`/users/userDetail/:userId`}
component={UserDetail}
/>
i want to get string "/users/userDetail" from some c...
Puto asked 5/4, 2019 at 0:36
3
I am new to react router I followed the tutorial for the latest version 6.4.3 and am using the createBrowserRouter.
For my App component below I attempted to add a children object to the index path...
Kuo asked 24/11, 2022 at 22:11
3
Solved
I made a react build with vite.js.
When building for production and testing on local host all is working fine. But when i deploy to Netlify or vercel routes that i created with react-router are not...
Beffrey asked 17/3, 2021 at 5:50
18
Is it possible to get the path pattern for the currently matched route? Example:
<Route
path=":state/:city*"
element={
<Page />
}
/>
// Page.jsx
function Page() {
...
...
Feces asked 18/2, 2021 at 18:3
7
Solved
I have header component like below:
import { useLocation } from "react-router-dom";
const Header = () => {
let route = useLocation().pathname;
return route === "/user" ? <ComponentA />...
Tan asked 28/1, 2020 at 12:44
7
Solved
I am trying to navigate to "/quiz" when Start Quiz button is clicked.
However when I compile my code I am getting the following error on the website application: [Home] is not a <Route...
Repeater asked 23/11, 2021 at 2:58
3
I'm using latest create-react-app config and facing the issues when switching between different routes.
All my SVG's are included in sprite file. Logically, sprite.svg file should be cached on the...
Shoot asked 2/6, 2018 at 17:58
3
Solved
There are a few questions like this on SO, but they are old and outdated and solutions don't work anymore
How can I change the title of the page so I don't have the same name in the History menu?
I...
Gracye asked 15/4, 2022 at 17:43
4
I'm using the useRouteError() hook from react-router-dom in a React project to catch any errors that may occur during routing. However, I'm not sure what the correct type for the error object retur...
Misadvise asked 5/4, 2023 at 23:56
37
I have the following:
How do I get rid of the blue underline?
The code is below:
<Link to="first"><MenuItem style={{paddingLeft: 13, textDecoration: 'none'}}> Team 1 </Men...
Red asked 7/6, 2016 at 2:2
2
I'm building a site with react and react-router and I have two different type of routes, like in the example bellow:
<Route name="products" path="/:type/*" handler={ ProductList } />
&l...
Kishke asked 22/6, 2015 at 11:37
49
Solved
Trying to get react-router (v4.0.0) and react-hot-loader (3.0.0-beta.6) to play nicely, but getting the following error in the browser console:
Warning: React.createElement: type is invalid -- expe...
Staw asked 15/3, 2017 at 14:57
9
Solved
On early versions we can go back to previous route using history.
history.goBack()
How I can achieve that with v6 of react-router-dom?
Noggin asked 29/1, 2021 at 4:11
3
What is the best way to conditionally render routes in react-router based on user role. I have a case where not all roles have permission to view certain routes. And also I need to deal with subrou...
Driftwood asked 17/1, 2022 at 15:8
1
I am trying to navigate to a page which may contain a percentage (%) sign in the url. e.g "www.domain.com/edit/name%"
if (some condition is met then redirect) {
let encodedString = encodeURICompo...
Harv asked 17/3, 2020 at 11:4
18
Solved
I'm using Material-ui's Tabs, which are controlled and I'm using them for (React-router) Links like this:
<Tab value={0} label="dashboard" containerElement={<Link to="/dashboard/home"/>}...
Cloudberry asked 6/9, 2016 at 6:44
© 2022 - 2025 — McMap. All rights reserved.