react-router
8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed
5.3.4 is the newest release of 5.x.
In short
3 breaking1 removed1 deprecated3 new2 fixed11 changed
- Breaking
Since the old context API is no longer used, any access to the old context will fail. Use of the react router context is not supported, please use
withRouter()or a<Route/>instead. - Breaking
Due to the new context API, mixing of imports will now result in an exception:
- Breaking
In development mode, we now throw an error when using 2 different builds (see b2c6fa0), i.E. combining CJS imports with ESM imports.
- Removed
Removed deprecated lifecycle methods
componentWillMountandcomponentWillReceiveProps - Deprecated
Per file imports are deprecated and will be removed in a future major version. For now, a warning will be logged.
Release note
Upgrade Warning
Please ensure you have upgraded both react-router and react-router-dom (react-router-native for RN users) to the exact same version. If different versions of those two packages are in your application, you will get errors when using <Link> and other react-router-dom-specific components. You can ensure you have the correct versions of both packages in your app using npm ls react-router react-router-dom.
Breaking Changes
- Breaking
Since the old context API is no longer used, any access to the old context will fail. Use of the react router context is not supported, please use
withRouter()or a<Route/>instead. - Breaking
Due to the new context API, mixing of imports will now result in an exception:
// Be careful, this won't work anymore!
import BrowserRouter from 'react-router-dom/BrowserRouter';
import { Route } from 'react-router-dom';
<BrowserRouter>
<Route />
</BrowserRouter>Refactor as follows:
// These are both from the same build and use the same context object
// so there won't be a mismatch :)
import { BrowserRouter, Route } from 'react-router-dom';- Breaking
In development mode, we now throw an error when using 2 different builds (see b2c6fa0), i.E. combining CJS imports with ESM imports.
New Features
<Route />now supports an array of paths - #5889 (thanks @baronswindle)
<Route path={["/BigApple", "/NYC", "NewYork"]} component={NewYork} /><Route />now supports multiple child nodes when using react >= 16.0.Migrated to new react context API, with a polyfill for react versions < 16.2
- Removed
Removed deprecated lifecycle methods
componentWillMountandcomponentWillReceiveProps Introduced more warnings in development builds
Changed build-process to rollup:
Smaller build size
Package now includes pre-minified files
Package now consists of single-file builds that include all modules.
Upgraded to history 4.9.0
- Deprecated
Per file imports are deprecated and will be removed in a future major version. For now, a warning will be logged.
Made sure that react router conforms to react
<StrictMode/>Fixed
<Link />not working properly with target="_self" - #6138 (thanks @ericyang89)Fixed <Route component> prop-type warning when using forwardRef - #6417 (thanks @frehner and @eXon)
Added support for createRef in <Link innerRef> - #6567 (thanks @gcangussu)
Removed use of
evalin development to be compliant with unsafe-eval CSP - #6611Migrated to
babel-preset-envImproved testing infrastructure to improve developer workflow
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.