

In v5.1, we released an enhancement to the handling of elements that will help smooth the transition to v6. It will be easier to make the switch to React Router v6 if you upgrade to v5.1 first. Then you can come back later and pick up where you left off. Once you've upgraded to React 16.8, you should deploy your app.

The good news is that React Router v5 is compatible with React >= 15, so if you're on v5 (or v4) you should be able to upgrade React without touching any of your router code. React Router v6 makes heavy use of React hooks, so you'll need to be on React 16.8 or greater before attempting the upgrade to React Router v6. The following is a detailed breakdown of each step that should help you migrate quickly and with confidence to v6. There will also be an explanation of why we made this change and how it's going to improve both your code and the overall user experience of people who are using your app. The examples in this guide will show code samples of how you might have built something in a v5 app, followed by how you would accomplish the same thing in v6. If you are just getting started with React Router, or you'd like to try out v6 in a new app, please see the Getting Started guide. This document is a comprehensive guide on how to upgrade your v4/5 app to v6 while hopefully being able to ship as often as possible as you go. It also introduces a few breaking changes from version 5. React Router version 6 introduces several powerful new features, as well as improved compatibility with the latest versions of React. Until then, we hope this guide will help you do the upgrade all at once! Introduction We recommend waiting for the backwards compatibility package to be released before upgrading apps that have more than a few routes. Then, you can incrementally update your code to the v6 API.

You'll be able to upgrade to v6 with minimal changes to your application code. This will make upgrading as smooth as possible. We are actively working on a backwards compatibility layer that implements the v5 API on top of the v6 implementation.

Upgrading from v5 Backwards Compatibility Package
