Upgrading React-Router-Dom from v5 to v6
React Router version 6 introduces several powerful new features, as well as improved compatibility with the latest versions of React. It also introduces a few breaking changes from version 5. 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. In this blog, as a leading JavaScript development company in USA and India, you can go through the important points of this new version.
1. Remove <Redirect/>s inside <Switch/>

2. Upgrade all <Switch/> elements to <Routes/>
● All <Route>s and <Link>s inside a
● Routes are chosen based on the best match instead of being traversed in order. This avoids bugs due to unreachable routes because they were defined later in your <Switch>
● Routes may be nested in one place instead of being spread out in different components. In small to medium-sized apps, this lets you easily see all your routes at once. In large apps, you can still nest routes in bundles that you load dynamically via React.lazy
<Routes> and
Whenever the location changes, <Routes> looks through all its children

3. Use usenavigate instead of useHistory
React Router v6 introduces a new navigation API that is synonymous with <Link> and provides better compatibility with suspense-enabled apps.
The useNavigate hook returns a function that lets you navigate programmatically, for example after a form is submitted. If using replace: true, the navigation will replace the current entry in the history stack instead of adding a new one.
The navigate function has two signatures:
● Either pass a To value (same type as <Link to>) with an optional second { replace, state } arg or
● Pass the delta you want to go in the history stack. For example, navigate(-1) is equivalent to hitting the back button

4. Rename <NavLink exact> to <NavLink end>
This is a simple renaming of a prop to better align with the common practices of other libraries in the React ecosystem.
5. Remove activeClassName and activeStyle props from <NavLink />
A <NavLink> is a special kind of that knows whether or not it is “active”. This is useful when building a navigation menu such as a breadcrumb or a set of tabs where you’d like to show which of them is currently selected. It also provides useful context for assistive technology like screen readers.
As of v6.0.0-beta.3, the activeClassName and activeStyle props have been removed from NavLinkProps. Instead, you can pass a function to either style or className that will allow you to customize the inline styling or the class string based on the component’s active state.

6. Get StaticRouter from react-router-dom/server
The StaticRouter component has moved into a new bundle: react-router-dom/server.
This change was made both to follow more closely the convention established by the react-dom package and to help users understand better what a
