3 ms·
react-router, do you mean v1, v2, v3, or v4 (or perhaps v5 and v6, I haven't checked if there was a new release with breaking API changes during the past 12 hou
by wereHamster 9y ago
react-router, do you mean v1, v2, v3, or v4 (or perhaps v5 and v6, I haven't checked if there was a new release with breaking API changes during the past 12 hours).
- sheeshkebab 9y agoWhy downvote? Anyone sane can't seriously be thingking of using react-router in anything non throw away - the library gets rewritten from scratch every year and doesn't provide any backwards compatibility or migration paths. You might as well just write your own react-router implementation for every react project you work on.
- forgottenacc57 9y agoAgreed. I need to switch from react-router. I think they are now making major changes for no good reason.
- buchanaf 9y agoI mean react-router is almost a 3 year old library trying to handle a rather complex problem. The first three versions were largely the same with no major changes that I can think of except for switching from context to higher order functions. I think everyone is a little dramatic about the number of versions of the library, especially when they are going to continue to support v3.
- ricardobeat 9y agoWell, that just makes things even worse - now you have to choose which version to use, which is just proving the OPs point.
- pluma 9y agoIf you don't like having to choose which version of react-router to choose, you probably should be using a preset like create-react-app which makes this kind of decision for you. Or you should use something other than React which includes everything and the kitchen sink.
- ricardobeat 9y agoExactly! (snark aside)
- buchanaf 9y agoThis doesn't really make sense to me. You have to pick a version for literally every single library you use. And those different versions have different interfaces, which is why they have different versions...
- deleted 9y ago[deleted]
- aleksandrm 9y agoRouting is not very complex.
- pluma 9y agoI'm not a fan of React Router but this sounds like you haven't actually used any of those versions or even looked at the breaking changes. Here's what actually happened: v1: https://github.com/ReactTraining/react-router/blob/v3/upgrade-guides/v1.0.0.md https://github.com/ReactTraining/react-router/blob/v3/upgrad... v2: https://github.com/ReactTraining/react-router/blob/v3/upgrade-guides/v2.0.0.md https://github.com/ReactTraining/react-router/blob/v3/upgrad... v3 mostly just removed APIs that were deprecated in v2. v3 continues being maintained even beyond the v4.0.0 release. v4: https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/migrating.md https://github.com/ReactTraining/react-router/blob/master/pa... In my opinion it would have been clearer if react-router v4 had been released under a different name but I guess the authors didn't want to pay the cost of that. The API changes between 1 and 2 as well as 2 and 3 are mostly cosmetic. It's worth pointing out the authors released codemods which will likely be able to convert your app from one version of the library to the next as long as you don't do something exceptionally clever. The changes between 0.x and v1 were entirely expected. It seems the authors followed the common semantics that 0.x releases are considered experimental, v1 was based on the lessons learned. v2 and v3 then improved upon that design with relatively minor changes. On the other hand v4 is an entirely new library using an entirely different paradigm: routes use component semantics and are part of the component structure, rather than just some JS router that uses JSX syntax for aesthetics. But as I said: v3 is still being actively maintained, the authors have just decided that the v4 API fits React better. And for all major releases from v1 to v3 you should be able to upgrade practically for free by using codemods. I think the importance of codemods can not be understated though many people are still ignorant of them: Facebook releases codemods for every major version of React and uses them internally to upgrade their tens of thousands of components automatically. Third-party libraries like React Router have also started providing them. Codemods written well should allow app developers to migrate breaking API changes in dependencies with practically no development effort. Additionally, like React, React Router seems to have adopted the approach of deprecating APIs in the final release of a major version that is no longer going to be supported so you can upgrade your manually code before moving to the new major version with no fear of things breaking. So when upgrading from v2 to v3 you should be able to upgrade safely by simply upgrading to the latest minor version and fixing any deprecation warnings. Both codemods as well as deprecations of course assume you're doing the sensible thing and a) upgrading one major version at a time and b) actually maintaining your project rather than just spending half an hour on it once a year to implement a new feature with no test coverage. Personally I often end up doing the not so sensible thing where I end up having to migrate all third party deps to the latest version once a year or two, but libraries like React and React Router are the least of my worries because they are extremely safe and easy to upgrade -- even to the point where there's no need to upgrade beyond React Router v3 unless you also prefer the v4 API.