News for hackers. Stuff that matters.
Re:Common Beginner Mistakes with React by otabdeveloper4 on Sunday March 12, 2023 @01:35AM (#35117406)
> less fluid

We're never replacing our old-style PHP internal tools, because according to business users it's "instantaneous", and any attempts to use a more SPA approach cause complaints about "sluggishness".

Re:Common Beginner Mistakes with React by eastbound on Sunday March 12, 2023 @03:58AM (#35117849)
Once the CGI page loads, all info is in there. React requires 1 request for the basic HTML, (1 request for the JS but it’s generally cached) and 1 request for the data from the REST API. It’s double the time to load a page.

React apps constantly have gray placeholders waiting for data to finish loading. Contrary to initial experiments, progressive rendering is recorded by the brain as a bad experience.

Re:Common Beginner Mistakes with React by zarzavat on Sunday March 12, 2023 @06:33AM (#35118536)
React is simply a library that renders your UI to the DOM. It doesn’t have any opinions on how your data is fetched, or how many roundtrips it takes. That’s an orthogonal concern. People have been using XMLHTTPRequest with CGI since the 00s, way before React was a twinkle in Zuck’s retinal sensors.

You can send your initial data for React with the HTML response if you want to eliminate the extra round trip on startup. Depending on the geographical distribution of your users it may or may not be worth it.

Re:Common Beginner Mistakes with React by robertoandred on Sunday March 12, 2023 @10:35PM (#35130199)
So just render the React page on the server and hydrate the markup after the page loads.
Re:Common Beginner Mistakes with React by terandle on Tuesday March 14, 2023 @03:16AM (#35148294)
React's new server components (only in next 13 at the moment, coming soon to other framework) addresses this problem. Of course react and node both have performance work they need to do also.
Re:Common Beginner Mistakes with React by pwdisswordfishc on Sunday March 12, 2023 @05:23AM (#35118243)
This but unironically.