React-router: [v6] `Link` component `to` prop can no longer receive function

Created on 30 Jun 2020  ·  4Comments  ·  Source: ReactTraining/react-router

In v5 we could pass a function (which would receive a location param) to the to prop. This no longer seems to be supported in v6, judging by the types:

https://github.com/ReactTraining/react-router/blob/262b45dd8d6cbdc3a984259c5591ffc3de80d600/packages/react-router-dom/index.tsx#L229

There doesn't seem to be any mention of this breaking change in the migration guide? Is it intentionally left out or do you plan to restore it for v6? FWIW I found this very useful, so that components don't have to manually read the location. IIRC there is more justification for this feature in the PR which initially added it in v5.

https://github.com/ReactTraining/react-router/pull/5368
https://github.com/ReactTraining/react-router/issues/5331

fresh

Most helpful comment

Oh, no, not again 🤦🏻‍♂️ Last time it took two years to merge my PR for v5, which implemented this functionality.

All 4 comments

Oh, no, not again 🤦🏻‍♂️ Last time it took two years to merge my PR for v5, which implemented this functionality.

Can we get a PR to add it back? V6 is a rewrite, which is why it didn't come over.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
You can add the fresh label to prevent me from taking any action.

We should keep this open because it represents a breaking change and many people could be affected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ackvf picture ackvf  ·  3Comments

alexyaseen picture alexyaseen  ·  3Comments

maier-stefan picture maier-stefan  ·  3Comments

davetgreen picture davetgreen  ·  3Comments

yormi picture yormi  ·  3Comments