Start adopting React Router v6 API using compatibility layer #2542
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
#2452
React Router v6 contains a number of breaking changes, however they have provided a helpful compatibility layer which allows us to start adopting the new APIs while still using v5. This means we don't have to update everything in one go (which would also require updating to React 18).
Change implemented so far:
useHistory
replaced byuseNavigate
Route
components, must be inside aSwitch
CompatRoute
to begin consuming the new APIsuseRouteMatch
from v5 which is not available in the new API. This also allows us to clean up theNamespacedRoute
and relatednamespacedMatch
used for navigation when switching namespaces avoiding the need to explicitly pass theallNamespacesPath
on each namespaced resource details page.Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
See the contribution guide
for more details.