Live data from Hacker News

React Router v5

reacttraining.com

51–60 of 90 posts

Re: React Router v5

#52

react-router depends on the ReactTraining/history package for browser navigation support. On 10 June 2017, an mind-bogglingly ill-conceived pull request[1] was merged, which causes invalid URLs to be pushed to the browser history, breaking the back button and page refresh in many scenarios. Ever since, users have practically been begging the maintainer to fix the bug[2] and implementing hacky workarounds[3]. In a twi…

This [0] indeed seems like such a rookie mistake, with all kind of edge cases ready to mess up the path encoding. The fact that they left such a broken behaviour in the lib for two years doesn't inspire much confidence.

0: https://github.com/ReactTraining/history/pull/465/files#diff...

Re: React Router v5

#53
post #13

Using react router on one of my personal projects (~ 30k loc) was probably one of my largest regrets. At every turn it seemed designed to do the thing I wouldn’t expect, or have arbitrary restrictions that made my life tougher. Some examples: * there's no relative routes https://github.com/ReactTraining/react-router/issues/2172 * there's no way to refresh the page https://github.com/ReactTraining/react-router/issues/…

> there's no relative routes https://github.com/ReactTraining/react-router/issues/2172

I've been managing "relative" routes by just using `match.path` and `match.url` from the previous route. Works fine.

    function Parent(props) {
      return (
        
          Child
          
        
      );
    }

    function Child({match}) {
      return (
        
          Grandchild
          
        
      )
    }

Re: React Router v5

#54

I migrated away from react-router because from v3 to v4 broke everything that made sense. Things became wildly more complicated. I'm now extremely happy with my new router of choice router5 (not to be confused with React Router 5) https://router5.js.org .

Oh, this looks promising. I'm pretty tired of react-router, and I like to keep my navigation in my redux state, as it's a big part of any application state in my mind.

How well does router5 work with redux? I see they have an official package for it, so it's looking good, but maybe you have first hand experience.

Re: React Router v5

#55
I had nothing but trouble whenever I used React Router. For example, sometimes paths would be appended to the URL instead of replacing it, making it grow indefinitely, and it wasn't obvious why.

There were two API rewrites in a short space of time and it was extremely frustrating, especially since it seemed almost compulsory to be experienced with React Router (along with Redux) to be taken seriously by recruiters.

For my own projects, I started using page.js years ago and haven't looked back.

https://github.com/visionmedia/page.js

Re: React Router v5

#56

I had nothing but trouble whenever I used React Router. For example, sometimes paths would be appended to the URL instead of replacing it, making it grow indefinitely, and it wasn't obvious why. There were two API rewrites in a short space of time and it was extremely frustrating, especially since it seemed almost compulsory to be experienced with React Router (along with Redux) to be taken seriously by recruiters. F…

Same here. I've had trouble with every version of React Router that I've used, and page.js seemed to always do pretty much exactly what I wanted.

I'm assuming that perhaps React Router is preferable beyond a certain amount of complexity? Can anyone chime in where page.js falls short?

Re: React Router v5

#58

I migrated away from react-router because from v3 to v4 broke everything that made sense. Things became wildly more complicated. I'm now extremely happy with my new router of choice router5 (not to be confused with React Router 5) https://router5.js.org .

Oh, this looks promising. I'm pretty tired of react-router, and I like to keep my navigation in my redux state, as it's a big part of any application state in my mind. How well does router5 work with redux? I see they have an official package for it, so it's looking good, but maybe you have first hand experience.

Very well. We've been using it for 1.5yr at work, keeping up-to-date with latest React and Redux.

Re: React Router v5

#59

I migrated away from react-router because from v3 to v4 broke everything that made sense. Things became wildly more complicated. I'm now extremely happy with my new router of choice router5 (not to be confused with React Router 5) https://router5.js.org .

Used v3 a few years ago at Linode and it was ok, if overly complex. The API changes resulting in v4 were so great that it basically became an entirely new project -- and the v4 docs are _still_ incomplete/not very helpful. Faced with learning a new project anyway I went with router5 at Capsule8.

Not only is router5's API simple, well-documented and easily programmable, the router5 folks have been receptive to feedback and pull requests. They also keep fairly well up-to-date compared to react-router (router5 supports React hooks, react-router doesn't yet).

I'm content with the direction and design of router5 and encourage others to check it out.

Re: React Router v5

#60

Earlier quoted context omitted.

Yeah that was my first reaction when I saw the title, "How hard is it going to be this time?" since it took me 2 days to migrate to the v4 last time.

Why upgrade?

Because sooner of later you'll have to. Upgrading frequently minimizes the delta.
Post reply on HN