Top "React-router-dom" questions

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

Multiple Nested Routes in react-router-dom v4

I need multiple nested routes in react-router-dom I am using v4 of react-router-dom I've got my import { BrowserRouter as Router, …

javascript reactjs react-router react-router-dom
Failed to compile. Module not found: Can't resolve 'react-router-dom'

After npm start, the browser gives the error: Failed to compile ./src/components/App/App.js Module not found: Can't …

javascript node.js reactjs react-router-dom
Jest, Enzyme: Invariant Violation: You should not use <Route> or withRouter() outside a <Router>

I have a <UserListComponent /> which outputs one <Contact /> component and list of contacts presentated by <…

reactjs react-router jestjs enzyme react-router-dom
React router Switch behavior

(react-router-dom version: 4.1.1) I have working routes set up, but I'm a bit confused about why the <Switch> was …

reactjs react-router react-router-v4 react-router-dom
React doesn't reload component data on route param change or query change

I have a "home" component with links, and when you click a link the product component is loaded with the …

javascript reactjs react-router react-router-v4 react-router-dom
How to get params in component in react router dom v4?

I have this code: <BrowserRouter> <Route path="/(:filter)?" component={App} /> </BrowserRouter> the filter param …

javascript reactjs react-router react-router-v4 react-router-dom
How to detect route changes with react-router v4?

I need to detect if a route change has occurred so that I can change a variable to true. I've …

reactjs react-router react-router-dom
react-router Redirect vs history.push

I was reading react-router-redux examples and I confused, what is the difference beetween: import { Redirect } from 'react-router-dom' ... <Redirect to=…

react-router react-router-v4 react-router-redux react-router-dom
Where's hashHistory in React Router v4?

I'm trying to use a router for my React application. I tried something I'd been using a while back, but …

reactjs react-router react-router-v4 react-router-dom
React Redux state is lost at page refresh

in my react app I have 3 components. from the 1st component by a button, I use Link to go to …

reactjs redux react-redux react-router-v4 react-router-dom