npm react-router 6.0.0-beta.6

latest releases: 0.0.0-nightly-96b441bdd-20240511, 0.0.0-nightly-5466640fc-20240510, 6.23.1...
2 years ago

No big enhancements in this release, just squashing bugs and writing lots of tests! Also, we are hard at work on cranking out examples for v6. See the end of this post for an update on our roadmap between here and v6 stable.

🧰 Examples

We have begun creating some examples for v6 that we hope will help developers make effective use of all the new features we have. So far, we have examples for the following:

  • Basic Example – A basic client-side app for v6 showing how to use nested routes, layouts, links, and the new <Outlet> API
  • Auth Example – Demonstrates an authentication flow including using the new useNavigate() hook, the <Navigate> element, and location.state
  • Search Params Example – Demonstrates how to build a simple search form that uses the new useSearchParams() hook
  • SSR Example – A server-rendered app that uses <StaticRouter> on the server and uses a <BrowserRouter> with ReactDOM.hydrate() on the client

Each example includes a button in the README that allows you to instantly launch a running instance on StackBlitz that you can play with. We hope you enjoy exploring!

🐛 Bugfixes

  • Make <NavLink> match only whole URL segments instead of pieces. This means that <NavLink to="/home/users"> will still be active at /home/users, but not at /home/users2. See #7523
  • Makes "layout routes" (routes with no path) never match unless one of their children do. See #8085
  • Fixes a route matching regression with splat routes that was introduced in beta.5. See #8072 and #8109
  • Fixes matching a nested splat route. See af7d038
  • Provide all parent route params to descendant <Routes>. This reverses a decision that we made in beta.5 to remove them. See #8073

💔 Breaking Changes

  • Splats in route paths (*) match only after a / in the URL. This means that <Route path="files*"> will always match as if it were <Route path="files/*">. The router will issue a warning if your route path ends with * but not /*

🛠 Roadmap

We are very close to a stable release! The last big code changes we need to make are:

  • Fixing "linking up". Currently a <Link to=".."> operates on the URL pathname. However, this makes it difficult to link to the parent route when you're in a splat route. See #8086. This will be a breaking change.
  • We are going to remove useBlocker() and <Prompt> in our initial v6 release, with plans to revisit them and possibly add them back at some point in the future. I still need to write up something here that explains our rationale. This will also be a breaking change.
  • We are going to add some animation primitives (see #8008). The <Routes location> prop will be in v6, but it isn't ideal for animation.

💻 Installing

Development for v6 is chugging along on the dev branch.

If you'd like to test it out, install from npm:

$ npm install history react-router-dom@next

Don't miss a new react-router release

NewReleases is sending notifications on new releases.