A Guide to Upgrading to React Router 4

Lekha Surasani
7 min readJan 12, 2019

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 in order to use a new UI library we were keen on switching to. 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. 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. Thus, we found that a lot of the packages were deprecated and needed to be replaced ASAP. One of the biggest surprises for us was the deprecation of react-router-redux. We were using react-router-redux in conjunction with react-router v3. This led us to think critically about why we were using redux in our router in the first place. 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. So, that left us in the position to just upgrade from react router 3 to 4, and remove react-router-redux from our application.

So, I was tasked with upgrading our router to v4 after only being in the position and working with React for only about 2 months. This was because upgrading from React Router 3 to…

--

--