Top "React-router-dom" questions

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

React-Router - Link vs Redirect vs History

There seems to be some confusion with what to use over the other: <Link to='/some/path'> &…

reactjs react-router react-router-v4 react-router-dom
React Router or Link Not Rendered

I am using react-router-dom in a redux app. This is my initial setup in index.js: ReactDOM.render( <Provider …

reactjs react-redux react-router-redux react-router-dom
React Router v4 renders multiple routes

I'm creating an SPA and I'm trying to setup Routing in the application using the react-router-dom package version 4.1.1. My Route …

reactjs react-router react-router-dom
react-router does not work in production and surge deployments

My react application is working fine on localhost but when after i deployed it in gh-pages or surge it does …

javascript reactjs react-router react-router-dom
Cannot read property 'history' of undefined (useHistory hook of React Router 5)

I am using the new useHistory hook of React Router, which came out a few weeks ago. My React-router version …

reactjs react-router react-hooks react-router-dom react-context
Attempted import error: 'useRouteMatch' is not exported from 'react-router-dom'

I have this error when I try to import useRouteMatch from react-router-dom module, I have this error : Attempted import error: …

reactjs react-router react-router-dom
BrowserRouter vs Router with history.push()

I am trying to understand the difference between BrowserRouter and Router of the react-router-dom (v5) package and what difference it …

reactjs react-router react-router-dom html5-history react-thunk
Root Navlink always get active class React Router Dom

I am using react-router-dom: 4.2.2. I can add activeClassName to the current URL. But surprisingly the class is always added to …

javascript reactjs react-router-dom
What is difference between react-router 4.0, react-router-dom and react-router-redux?

I am implementing routing in react-application. I am confused between the advantage of react-router 4.0 over react-router-redux. I am also confused …

reactjs react-router react-router-dom
Create-React-App failed to compile | Import/First Error

I'm currently using Create-React-App for my personal site. I keep getting the following errors every time I run it: ./src/~/…

reactjs import importerror create-react-app react-router-dom