Hacker Newsnew | past | comments | ask | show | jobs | submit | ryanflorence's commentslogin

Remix co-author here. We haven't "missed on RSC", they aren't even released!

We already have experimental versions of Remix running on React 18 and have experimented with RSC, Suspense, and streaming extensively. In their current state however, we're not seeing them beat Remix's current approach in production results or developer ergonomics. We've been providing the React team with our feedback. When these features from React are ready, Remix will be able to easily support them.


Remix co-author here. Infinite scroll/pagination is a great way to test the limits of a web framework!

Remix doesn't ship an infinite scroll/pagination set of components so it's up to apps to make sure that state is still there when the user clicks back. If the state is still there, Remix's scroll restoration will work.

You could either manage your own global state for this, but I like to use "location state" which is our API into the browser's built in `history.state`.

There are various ways to use it (declaratively, imperatively, etc.), but simplest way to explain is to imagine a "Load more" button that's really just a link like this:

`<Link to="?page=2" state={{ data }} />`

Your Remix loader would load page 2 from the url search param and your component would concat that onto `location.state.data` (the previous entries from the initial location). This renders the old data and the new data together.

Location state, unlike typical "global state", automatically persists across both refreshes and back/forward button clicks, but dies with the session, so scroll restoration will work as expected even for a refresh! Built in browser APIs tend to be a bit more resilient than storing stuff in application memory, they also keep your bundle smaller.

I don't know where the demo is, but I helped somebody at some point implement this without needing to ship a global state container for server-supplied data. Just made a note to make an example and put it our repo :)

If we're talking "load more" a much simpler way to do it is to consider how you'd do it old school with no JS. Just return all pages according to the search param, so "?page=3" would return all three pages. More kB over the network, but far easier to implement. There's even a product reason to do it this way: when you load more you automatically update the comment counts/points of each entry, so maybe it's worth it.

Great question!


> I like to use "location state" which is our API into the browser's built in `history.state` ... Location state, unlike typical "global state", automatically persists across both refreshes and back/forward button clicks, but dies with the session, so scroll restoration will work as expected even for a refresh! Built in browser APIs tend to be a bit more resilient than storing stuff in application memory, they also keep your bundle smaller.

This sounds great! I never thought of using history state to store arbitrary data. Thanks for the explanation!


Author here.

One more time for those in the back:

v0.x > v1 Breaking changes

v1 > v2 > v3 a couple obscure breaking changes, but practically none

18 months pass

v3 > v4 New, composable design, basically a new project

v3 still maintained, 3.5 years no changes. v4 2 years, no changes.

v4 -> v5 was supposed to be 4.4, but an internal dependency '^' got us, so best choice was version bump to prevent problems.


I think it was the fact that v3 to 4 was "basically a new project" with a new paradigm that earnt the reputation for breaking changes but then React Router is such a marketable name I can see why you'd be reluctant to spin off a new project.


Jimmy. Jimmy 2020, my man. Did you click the link? Did you notice how every link on the page links to a free video? Did you see the paragraph at the top of the page explaining that these free videos are part of a larger course?

No? Huh.


Sorry about that, meant to say "lectures" not "videos" ... But I mean ... the videos for every pattern is free, so if we're gonna split hairs the title is correct!


Not any time soon, gotta pay the bills somehow! :P


Following stable releases we had one breaking API change in 2 years from 0.13 -> 1.0. 2.0 was fully BC, 3.0 removed 1.0 API 8 months after 2.0 was released. People shouldn't install beta/alpha like its stable and then complain to us about it.


you get location.search, which is just a string. We removed default query handling because it can be composed in with something like `RouteWithQuery` and `LinkWithQuery`. Lots of people didn't want the default serialization anyway. It's like 7 lines, we'll have an example of it you can copy/paste.


0.13 -> 1.0 was breaking 1.0 -> 2.0 was fully BC

That was 2 years with only one breaking change.

2.0 -> 3.0 removed deprecated 1.0 API, fully BC with 2.0

The only churn is for people who don't stick to stable releases, and that's their own problem.


v2.0.0 released this on Feb 10, 2016

v3.0.0-alpha.1 released this on May 19, 2016

v3.0.0-alpha.3 released this on Aug 2, 201

v3.0.0-beta.1 released this on Sep 16, 2016

v4.0.0-0 released this on Sep 13, 2016

v3.0.0 released this on Oct 24, 2016

> ... and that's their own problem.

Hence deprecation right out the gate. V4 is much better, great work - but blaming users for API churn does not make me confident. Sure users could have used a stable release, but then upgrade twice? What confidence is there that it won't churn again?


I'm so confused. There are only two actual releases there: v2.0.0 and then 8 months later v3, where all that happened was v1 API was removed. If you only keep up with the stable releases your life has been simple with React Router.


Also, don't upgrade. v3 is going to maintained with bugfixes and whatever needs to happen to be compatible with new React releases indefinitely.


1) Not sure why navigating is "more complex on native". The platform the code runs on has nothing to do with the way the user interacts with the page. Complex navigation state is represented as one or many stacks of URIs.

2) In React Router you can have a statically available route config. This is React. Make an array then map it to render.

3) React Router is all components, so it composes exactly like the rest of your app. No new API to learn. It's Just React™


Navigating isn't more complex in native apps, and I didn't mean to imply that. But navigation state may be deeper than flat sets of URIs: it may be a tree.

For example: your app may have a stack of modal screens, and each of those screens may have tabs or a stack, and there may be another tab or stack navigation within each of those. In React Navigation, each node can be a router that manages its own navigation state.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: