Live data from Hacker News

React Router 6

reactrouter.com

11–20 of 49 posts

Re: React Router 6

#11
post #2

Usually new versions excite me, but with React Router I can only wonder: how much of a re-write will I need to do?

Seriously, the upgrades are always such a massive pain.

The v5 -> v6 doc is already making me dizzy just from how long it is https://reactrouter.com/docs/en/v6/upgrading/v5

Re: React Router 6

#12
post #4

I think we're at an interesting time for React routing. It seems like a ton of shops are standardizing on Next.js as a base for new projects, especially if you're building a pretty vanilla web app. Since Next takes care of routing for you, the need for projects like this operating at huge scales is diminishing. I'm glad they still exist for teams that want/need to own the entire application stack, but there are benef…

I'm not sure about that, Next.js' routing is very limited compared to React Router, so much so that I actually spent some time evaluating whether it was worth introducing react-router and skipping Next's half-arsed implementation of a router in a project at work. I've been very vocal against Next multiple times recently, so I'm definitely biased, but I wouldn't use it for anything more than a basically static web app…

Absolutely. Next’s router kind of kneecapped a feature we were building out recently and we had to adjust our implementation accordingly.

The router is so deeply entwined with getServerSideProps - we couldn’t find a way, including using shallow transitions, to push to the same path without triggering rebuilding the page due to a request to next/_data which returned the corresponding server side props.

Amongst other things. It’s a wonderful framework, there’s no question. The router is definitely not its strength though.

Re: React Router 6

#14
post #2

Usually new versions excite me, but with React Router I can only wonder: how much of a re-write will I need to do?

Seriously, the upgrades are always such a massive pain. The v5 -> v6 doc is already making me dizzy just from how long it is https://reactrouter.com/docs/en/v6/upgrading/v5

People should really take Next.js as an example here.

They make sure it's backwards compatible as much a possible and when it's not they provide a codemod or the app tells you what's wrong (and how to fix it!) when you try to run it.

If course the latter is hard/impossible with a lower level library like this but the former is def. possible.

Emotion css decided to rename/reshuffle all their packages and imports in v11 which was a massive pain, but with the provided codemod that migration was not too painful.

Re: React Router 6

#16
post #9

I think we're at an interesting time for React routing. It seems like a ton of shops are standardizing on Next.js as a base for new projects, especially if you're building a pretty vanilla web app. Since Next takes care of routing for you, the need for projects like this operating at huge scales is diminishing. I'm glad they still exist for teams that want/need to own the entire application stack, but there are benef…

Next's router is the only thing that holds me back from fully embracing it. It sucks that I have to give up every other awesome thing the framework offers when I have a project that does not fit with their router. Hoping something changed in the last year and someone can point me to a solution

I'm curious: what specific problems are you running into?

Re: React Router 6

#18
post #9

I think we're at an interesting time for React routing. It seems like a ton of shops are standardizing on Next.js as a base for new projects, especially if you're building a pretty vanilla web app. Since Next takes care of routing for you, the need for projects like this operating at huge scales is diminishing. I'm glad they still exist for teams that want/need to own the entire application stack, but there are benef…

Next's router is the only thing that holds me back from fully embracing it. It sucks that I have to give up every other awesome thing the framework offers when I have a project that does not fit with their router. Hoping something changed in the last year and someone can point me to a solution

So just use next with react-router?

Re: React Router 6

#19
post #18
post #9

Earlier quoted context omitted.

Next's router is the only thing that holds me back from fully embracing it. It sucks that I have to give up every other awesome thing the framework offers when I have a project that does not fit with their router. Hoping something changed in the last year and someone can point me to a solution

So just use next with react-router?

Kinda defeats the purpose of NextJS's organization - the filesystem based routing is pretty key to their server side rendering logic and the cornerstone of their sensible defaults for making performant applications out of the box, vs just having a wildcard route that runs React Router - might as well just use CRA in that case, no?

Re: React Router 6

#20
post #18

Earlier quoted context omitted.

So just use next with react-router?

Kinda defeats the purpose of NextJS's organization - the filesystem based routing is pretty key to their server side rendering logic and the cornerstone of their sensible defaults for making performant applications out of the box, vs just having a wildcard route that runs React Router - might as well just use CRA in that case, no?

> might as well just use CRA

Why would anyone use CRA when there is next? Either I write my webpack config, or I use a comercial tool with sensible default, and the flexibility to mix and match single page and SSR in the future.

Post reply on HN