react-router-v4 Questions
3
What is the difference between React router.push and router.replace?
Frampton asked 23/10, 2018 at 17:35
4
Solved
I have a huge Django web app, with one of it's modules (a 'dashboard') written with node and react. User login is handled by a Django module.
The user should be logged into the main app in order t...
Lowland asked 19/7, 2017 at 17:29
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
4
Solved
I want to pass more than one state for my next page which I'm redirecting from my another page.
I'm already passing one and that is working fine.
<Link to ={{pathname: "/CreateEventUser&quo...
Caird asked 25/11, 2017 at 9:23
2
Solved
Issue
With React Router v4, how do I differentiate between goBack() and goForward() calls with the listen() method?
As far as I can tell, the location and action parameters don't give enough in...
Yellow asked 13/8, 2018 at 15:14
5
Solved
I expect that console.log('Refresh') runs every time the route changes (switching from Component1 to Component2). But it's only triggering on first render. Why?
index.js:
import React from 'react...
Lonergan asked 18/9, 2019 at 6:31
2
I have an app created with create-react-app that I want to install in a subdirectory on my website. The recommended way is to add process.env.PUBLIC_URL as the baseurl. ie:
<Route exact path={`...
Brune asked 7/1, 2018 at 6:12
22
Solved
I was trying to implement authenticated routes but found that React Router 4 now prevents this from working:
<Route exact path="/" component={Index} />
<Route path="/auth&qu...
Mukluk asked 2/4, 2017 at 4:11
10
Solved
I'd like to display a title in <AppBar /> that is somehow passed in from the current route.
In React Router v4, how would <AppBar /> be able to get the current route passed into it's ...
Metabolite asked 15/2, 2017 at 15:17
3
I'm building a website with React and using React-Router, I'd like to render a 404 page when a url is visited by the user that doesn't exist.
Some urls are dynamic, say,
www.site.com/user/(usern...
Uprush asked 15/8, 2017 at 13:56
2
I want my app to be served from a subdirectory , say localhost:3000/base , So that the routes page1 and page2 are served at localhost:3000/base/page1 and localhost:3000/base/page2
I tried using bas...
Ness asked 21/10, 2020 at 19:51
7
I have two <Route>s created with react-router.
/cards -> List of cards game
/cards/1 -> Detail of card game #1
When the user clicks on the "Return to list", I want to scroll the user wher...
Imparipinnate asked 18/8, 2018 at 8:22
15
Solved
I used react-router-dom and I build my react-app. When I deploy it on the server, I get a blank page and the console is empty.
My App.js is :
import React, { Component } from 'react';
import { Ro...
Sansbury asked 9/5, 2019 at 7:27
5
Solved
My React routes are defined as follows:
...
<Route component={Header} />
<Route exact path="/" component={Landing} />
<Route path="/about" component={About} />
<Route path="/c...
Mathur asked 21/7, 2018 at 15:26
8
Solved
I want to declare a path with an optional path parameter, hence when I add it the page to do something extra (e.g. fill some data):
http://localhost/app/path/to/page <= render the page
http:...
Unhandsome asked 24/2, 2016 at 14:18
5
Solved
I'm using jest to test a component with a <Link> from react-router v4.
I get a warning that <Link /> requires the context from a react-router <Router /> component.
How can I moc...
Truism asked 3/5, 2017 at 23:24
2
I'm setting a basename path like this:
<BrowserRouter basename="/calendar"/>
Is it possible to access that basename property in any of the app's components via React Router somehow? Otherw...
Rival asked 21/5, 2018 at 12:56
10
Solved
I have to implement some business logic depending on browsing history.
What I want to do is something like this:
reactRouter.onUrlChange(url => {
this.history.push(url);
});
Is there any wa...
Leann asked 28/7, 2017 at 12:36
3
Solved
I'm trying to redirect the user to the login page when the /logout routes is hit. The auth is working (jwt token is removed, but the app fails to redirect to /login.
Also If I do to / the app crash...
Whitening asked 25/8, 2017 at 22:48
10
Solved
I am relatively new to reacts and I'm trying to figure out how to get React router to work. I've got a super simple test app that looks like this:
import React from 'react';
import ReactDOM from '...
Aldercy asked 17/4, 2017 at 17:51
3
Solved
Ok, I'm fed up trying.
The onEnter method doesn't work. Any idea why is that?
// Authentication "before" filter
function requireAuth(nextState, replace){
console.log("called"); // => Is not t...
Hefner asked 13/3, 2017 at 16:23
2
Solved
I am building a React project without Redux.
I would love to have two, or in this case 3 different Switches
1st Switch will be able to Switch between Home page (normal website) and UserPage (Dash...
Incus asked 10/3, 2018 at 11:2
7
Solved
Besides the ability to set an "activeClassName" and "activeStyle" on NavLink, is there any reason to use NavLink over Link when creating links to other routes on non-navigational elements (ie. not ...
Choral asked 16/11, 2017 at 19:56
9
I am developing an application in which I check if the user is not loggedIn. I have to display the login form, else dispatch an action that would change the route and load other component. Here is ...
Radiancy asked 23/5, 2017 at 6:54
14
Solved
I have a couple of buttons that acts as routes. Everytime the route is changed, I want to make sure the button that is active changes.
Is there a way to listen to route changes in react router v4?...
Beat asked 28/1, 2017 at 15:10
1 Next >
© 2022 - 2025 — McMap. All rights reserved.