Top "React-router-dom" questions

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

Detect Route Change with react-router

I have to implement some business logic depending on browsing history. What I want to do is something like this: …

reactjs react-router react-router-v4 react-router-redux react-router-dom
React : difference between <Route exact path="/" /> and <Route path="/" />

Can someone explain the difference between <Route exact path="/" component={Home} /> and <Route path="/" component={Home} /> …

reactjs react-router react-router-dom
How to get query parameters in react-router v4

I'm using react-router-dom 4.0.0-beta.6 in my project. I have a code like following: <Route exact path="/home" component={HomePage}/&…

react-router react-router-v4 react-router-dom
How to parse query string in react-router v4

In react-router v3 I could access it with props.location.query.foo (if the current location was ?foo=bar) In …

reactjs react-router react-router-dom
Invariant failed: You should not use <Route> outside a <Router>

I use react-router-dom for routing in my React application. Part of my app extracted in another package. List of dependencies …

reactjs react-router react-router-dom
ReactJS - Pass props with Redirect component

How should you pass props with the Redirect component without having them exposed in the url? Like this <Redirect …

javascript reactjs react-router-dom
Simple Conditional Routing in Reactjs

How to make conditional Routing, if and only if some conditions satisfies then only routing should happen. for example, if …

reactjs react-router react-redux react-router-v4 react-router-dom
Uncaught TypeError: Cannot read property 'push' of undefined (React-Router-Dom)

I have a Dashboard with rotating slides, each of which has a corresponding tab in Bldgs. Both Dashboard.js and …

javascript reactjs react-router react-router-dom
React wrapper: React does not recognize the `staticContext` prop on a DOM element

I'm trying to create a wrapper component around the react-router-dom NavLink component. I would like my custom component to accept …

reactjs react-router react-router-dom
How to navigate on path by button click in react router v4?

I have this paths in react-router-dom: <BrowserRouter> <div> <Route exact path='/(index.html)?' …

javascript reactjs react-router-v4 react-router-dom