Lots of great stuff in this release, especially if you like Intellisense :)
- Migrated the core codebase to TypeScript and added TypeScript declarations
- Added a migration guide for folks coming from reach/router
useInRouterContexthook for determining if you're in the context of a router or not
matchPathfunction for manually matching paths to URL pathnames
Note: experimental features rely on an experimental release of React and will probably be moved into a separate "experimental" release channel in the near future.
Warning: This release breaks compatibility with 6.0.0-alpha.3
[searchParams, setSearchParams](similar to
setSearchParamsis a wrapper for
navigatethat updates the query string on the current URL. See the updated guide on working with the query string.
- Removed the
<StaticRouter context>API. We don't support navigation on the initial render in v6, so this API is unnecessary.
useMatchtakes a route
path(instead of a link
tovalue as it did previously). It should have always taken a route path; this was just a simple oversight.
- Fixed a bug with multiple nested * routes
- Force stable sort in browsers that don't have it so routes that otherwise rank equally maintain the order in which they were originally defined
Development for v6 is happening on the
If you'd like to test it out, install from npm:
$ npm install react-router@next react-router-dom@next
Or, if you're on React Native:
$ yarn add react-router@next react-router-native@next
We are actively working on documentation. For now, if you're just interested in testing things out you may be interested in the getting started guide. If you're interested in upgrading an existing app, please check out the v5 to v6 migration guide.