v6.0.0-beta.7
Pre-releaseIn this release we made a small but significant change to how <Link to="..">
works. This is going to help out a lot if you were trying to use links in a *
route.
We have also backed out our blocking/prompt APIs for the stable v6 release. We will revisit this post 6.0 when we have a little more time to get it right.
✨ Features
The major change in this release could also be classified as a bugfix or a breaking change, depending on how you look at it. We essentialy altered the way <Link to="..">
works. See #8086 for the motivation behind this change.
You'll probably want to reread the section in the v5 => v6 migration guide about <Link to>
values (it has been updated), but it basically boils down to this: any leading ..
segment in a <Link to>
value traverses "up" one route and builds upon that route's path instead of just removing one URL segment. This feature really completes the story of relative routes and links.
We could consider this a bugfix, since this is how it was always intended to work in the first place. Without it, you'd have a difficult time linking predictably in *
routes because your <a href>
would be different depending on the number of segments in the current URL.
The reason this could also be considered a breaking change is that ..
now works slightly differently in <Link to>
than it would in <a href>
. When you have <a href="..">
it operates on the URL pathname, removing one segment of the current URL. However, since many routes really only match a single segment of the URL, there is often no difference between <Link to="..">
and <a href="..">
.
💔 Breaking Changes
- We removed
useBlocker()
,usePrompt()
, and<Prompt>
for now. We will revisit these post 6.0 when we have more time to get it right. But we don't want it to block (see what I did there) the release of all the other awesome stuff we've got in v6.
🛠 Roadmap
We anticipate this will be the last beta release before v6 stable next week. Please give it a shot and let us know how it goes!
👍 Upgrading
If you're thinking about upgrading to v6, I published a few notes this past week that may help you:
- This note talks about removing
<Redirect>
elements from any<Switch>
es you may have in your v5 app and how you can get better SEO in the process if you're currently relying on client-side redirects. - This note talks about how to refactor your code to avoid "wrapping"
<Route>
elements, which won't work in v6.
Both of those posts contain steps you can take today in your v5 app without upgrading to v6.
We are also developing a backwards compat lib that should help some of you upgrade from v5 to v6. We'll post more about this when it's ready.
💻 Installing
Development for v6 has switched from dev
to the main
branch.
If you'd like to test it out, install from npm:
$ npm install history react-router-dom@next