12/8/2023 0 Comments React router dom versions![]() History comes in many forms for react-router, and could take a while to explain. History is an essential part of routing, allowing us to remember where we came from and where we are currently. This means you also have to update any react-router import statements to react-router-dom. React Router v4 package structure changed such that it’s no longer necessary to install react-router - you have to install react-router-dom (and uninstall react-router), but you don’t lose anything since it re-exports all of react-router’s exports. I’ve split up this guide into 5 different parts: The creators of React Router wanted to go back to a simple Router, allowing the developer to customize it however they would like. ![]() The biggest change to note, from the creators of React Router, is that the upgrade from React Router 3 to React Router 4 is more than just updating a few libraries and features - it allows you to fundamentally change how your Router works. Looking through the documentation, the GitHub repo, and many, many Stack Overflow answers, I finally pieced together the steps for the upgrade and wanted to share my findings - especially to explain how and why certain changes are made. But, as I quickly found out, it was a little bit more involved than I anticipated. This was because upgrading from React Router 3 to React Router 4 sounded like it should be a trivial undertaking. So, I was tasked with upgrading our router to v4 after only being in the position and working with React for about 2 months. So, that left us in the position to just upgrade from react router 3 to 4, and remove react-router-redux from our application. Once we started to look into react router v4, we realized that the new features would pretty much eliminate any reason for us to use an additional library to connect our router and redux. This led us to think critically about why we were using redux in our router in the first place. ![]() We were using react-router-redux in conjunction with react-router v3. One of the biggest surprises for us was the deprecation of react-router-redux. Thus, we found that a lot of the packages were deprecated and needed to be replaced ASAP. The beginnings of our code base had been built by developers who used whatever open source or third party library they wanted, without actually vetting them. To figure out how much time this upgrade would require, we looked at all of our current packages to see if they were compatible with React 16, and to see if we were still using unsupported or deprecated packages. Not long after I started working at my current position, the team realized that it would be necessary for us to upgrade to React 16 so we could use a new UI library we were keen on adopting.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |