News for hackers. Stuff that matters.
Re:Show HN: Hacker News clone using Remix and React by baobabKoodaa on Thursday February 17, 2022 @01:49PM (#30377011)
> 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!

There are no comments on this comment yet.