Support for legacy prefix-based route patterns (e.g., /services*) in React Router v6 #14609
Unanswered
sandeep3690Butte
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We are migrating a large application from React Router v4 to v6 and have encountered an issue with route patterns that use prefix-based matching.
In v4, we used patterns like /services* to match any URL starting with /services (e.g., /services-in-city, /services/foo, /services/foo/bar). These patterns are heavily used in our production application for:
Campaign URLs
Push notifications
Multiple native and web views
React Router v6 removed support for this type of path matching. Currently, only a single wildcard * at the end of the path is supported, and arbitrary regex or prefix-based patterns are no longer allowed.
Problem:
Migrating existing paths directly is not feasible because these paths are already used in many production scenarios.
Changing the paths would break campaigns, push notifications, and other integrations.
There is no direct way in v6 to express “any path starting with /services” with the same semantics as v4.
Request:
Consider adding support for legacy prefix-based routes or a configurable matcher system that preserves backward compatibility for production apps migrating to v6.
Beta Was this translation helpful? Give feedback.
All reactions