News for hackers. Stuff that matters.
Re:None of my projects want to be SPAs by WrtCdEvrydy on Monday February 11, 2019 @10:51AM (#19135268)
Redux was the solution to server side rendering state.

If you don't use redux, then keeping state synced with a server side rendered application because nearly impossible.

Re:None of my projects want to be SPAs by kerkeslager on Monday February 11, 2019 @10:57AM (#19135335)
> Redux was the solution to server side rendering state.

Could you explain what you mean by "server side rendering state"?

Re:None of my projects want to be SPAs by WrtCdEvrydy on Monday February 11, 2019 @11:02AM (#19135393)
Server side rendering mounts your application in the server and sends down html along with an initial state.

The client receives this initial state and uses it with the html to glue together a working UI on the client.

This removes the massive JS bloat into raw html and split JS for each component.

Instead of sending 3MB of JS, you send only the JS needed to render the current page... and send additional JS as a user navigates through your website.

Here's an example with Create React App: https://github.com/cereallarceny/cra-ssr

Re:None of my projects want to be SPAs by kerkeslager on Monday February 11, 2019 @11:19AM (#19135550)
Okay, but that's an even worse idea than what I've seen Redux used for. Now you're splitting the UI between client and server in a completely custom way, that adds even more complexity. Worse, the performance is likely to be worse because now you're paying the bulk JS load cost of loading Redux AND the latency cost of loading small parts as you go: the worst of both worlds. I doubt this is what the Redux folks had in mind, but if it was, it's even worse than I thought.
Re:None of my projects want to be SPAs by kalcode on Monday February 11, 2019 @01:33PM (#19136910)
>because now you're paying the bulk JS load cost of loading Redux

Gonna have to quantify that. Cause I imagine if you did, you'd redact that statement. Redux is a very straightforwards and SMALL library that handles global state.

Its concept can be difficult to follow at first which may cause some to think it way more complex under the hood than it really is.

Re:None of my projects want to be SPAs by WrtCdEvrydy on Monday February 11, 2019 @04:10PM (#19138387)
> you're paying the bulk JS load cost of loading Redux

Redux is small.

> the latency cost of loading small parts as you go

The components are static JS split into files.

Pop those into a CDN and you get the best of both worlds.

Re:None of my projects want to be SPAs by s_y_n_t_a_x on Monday February 11, 2019 @11:39AM (#19135719)
Redux is tiny. And with HTTP2 it's better to send multiple small resources than one large payload, especially when it's JS which will lock up when parsing.