-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X1034 react router upgrade to 6.0 #400
Conversation
Refactoring Route switching and createBrowserRouter to support Prompt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very thorough. I have some questions just for understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you answer my questions from the last review please?
@khelwood I have answered and made changes as well yesterday. I can see my comments above. If you can't please let me know |
react-router-dom updated from v5 to v6.15
Following are the main changes
Prompt deprecated in v6 instead used a third-party library. react-router-prompt
Major changes in route switching
with a wrapper component pattern which uses Outlet
- Replaced AuthRoute with AuthLayout
Redirect replaced with
NavLink property ‘exact renamed to ‘end’
useNavigate instead of useHistory
history.push replaced by navigate
- Link props change
- NavLink - activeClassName and activeStyle props removed from NavlinkProps. Instead a function required to return either style or className that will allow you to customize the inline styling or the class string based on component’s active state
RouteComponentProps doesn't exist in v6
navigate(0) to reset the current page
Logout changed as a jsx element. All component children of Routes must be a Route or React.Fragment
Use loader and useLoaderData instead of DataFetcher if need to access query params before loading page (e.g FileManager, LocationByBarcode)
Reference for Migration from v5 to v6
https://reactrouter.com/en/main/upgrading/v5#upgrade-to-react-router-v51