IDK who needs to hear this, but you don't have to pretend that React or Redux do "state management".
-
Confusion about the difference between *real* state management and...whatever the React ecosystem is talking about...is underneath a LOT of the pain I see teams work through.
So if your system is confused ("agnostic") about sync, it isn't managing state. So we don't have to keep calling it "state management", because it isn't doing that.
-
Alex Russellreplied to Alex Russell last edited by [email protected]
"State management" implies that something about the state of the application is managed. To accomplish that, we need data change propagation (which reactive tools like Lit or FAST or Svelte or Solid or Vue or Preact or even React -- because you need IE 9 support, I guess? -- make simpler) as well as some way to coordinate state with the server.
That latter half is where CRDTs and sync systems come in; tools like Replicache, Zero, and YJS.
-
A reminder: unless users are taking, or the server is sending, many related actions *about the same data set* per session, all you need is progressive enhancement and a bit of Ajax.
-
@slightlyoff I am gonna be really happy if this rant turns into a very well-reasoned essay promoting CRDTs...!
-
@slightlyoff fwiw, there's a tiny "Add text" below progressive enhancement that looks like it shouldn't be there
-
@eta Hah! Thanks. Will fix
-
@mogul ...but mostly not assuming you need client-side state caches when you don't (which is most of the time)!
-
Marc-Antoine Ruelreplied to Alex Russell last edited by
@slightlyoff In my toy project, I switched to sending unmodified app HTML.
For server-side injection, I do an additional write() to the tcp pipe adding a block "<script>let preloadedata = {{...}};<script>".
Then the web app can check if preloaded data is there or not and use it to save a round trip.
I don't understand why this is not the state of the art? Everything else sounds unnecessarily complex. -
Alex Russellreplied to Marc-Antoine Ruel last edited by [email protected]
@maruel Redux + SSR trends to result in huge inline JSON blobs, presumably to do the same. But then it gets the whole React dump truck emptied on top. View-source on the NYT sometime for a sense of how obscene this can get.
-
Marc-Antoine Ruelreplied to Alex Russell last edited by
@slightlyoff I recently listened to a talk about Remix and it sounded awfully complicated and fragile. I can't imagine making it fast.
-
Alex Russellreplied to Marc-Antoine Ruel last edited by
@maruel A lot of web developers have become disconnected from what "fast" even means. They think their slow things are fine, in part, because they literally don't know better.
-
@maruel Something you can't un-see once you've thought about it: the whole React-ish ecosystem forced tall and slow compiler toolchains down everyone's throats, but never bothered to use those compilers to elide runtime work...which, you *might* think, would be the point of a compiler.
Svelte *et al* did better, but in general there's no understanding of even the opportunity space among the current culture of frontend developers. They assume a floor of *at least* 45+KB of JS.
-
@maruel Anyway, I'll be here, rehashing my ~2016 critiques of desktop-era JS frameworks until they either:
- go out of fashion
- succeed in killing the web outright
- go out of fashion because they killed the webStop by any time!