News for hackers. Stuff that matters.
Re:React Router v5 by sorahn on Thursday March 21, 2019 @06:43AM (#19450770)
> 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 (
        <>
          <Link to='/child'>Child</Link>
          <Route path='/child' component={Child}/>
        </>
      );
    }

    function Child({match}) {
      return (
        <>
          <Link to={`${match.url}/grandchild`}>Grandchild</Link>
          <Route path={`${match.path}/grandchild`} component={Grandchild} />
        </>
      )
    }
Re:React Router v5 by stickfigure on Thursday March 21, 2019 @09:52AM (#19452313)
I also do this - 4 layers deep at times - and it works great. IMHO it's one of the more clever bits of react-router.
Re:React Router v5 by sorahn on Thursday March 21, 2019 @06:28PM (#19457979)
Yup. My "top level routes" only have 3 paths, and everything goes from there. Thinking about routes just like components is really fantastic for react, and I don't miss having a giant central router even a little bit.