News for hackers. Stuff that matters.
Re:Why React Re-Renders by srk_hn on Tuesday August 16, 2022 @04:20PM (#32488316)
Can someone tell me why this page needs 13MB of resources to display?
Re:Why React Re-Renders by fabian2k on Tuesday August 16, 2022 @04:27PM (#32488423)
It's even more for me, it looks to me like the embedded React sandboxes are essentially full React apps in development mode. So none of the usual optimizations for size are active, and you get the full devel-mode bundle for several React applications on this page.
Re:Why React Re-Renders by MH15 on Tuesday August 16, 2022 @04:30PM (#32488458)
My guess is for the code editors and associated transpiler. The demos allow you to edit the code in JSX, requiring the tooling. Kinda impressive imo.
Re:Why React Re-Renders by quickthrower2 on Tuesday August 16, 2022 @08:10PM (#32490731)
This page doesn't know if it is an app or blog post then! Maybe it should lazy load those resources?
Re:Why React Re-Renders by neon_electro on Tuesday August 16, 2022 @04:30PM (#32488459)
Here are the top requests by file size from the page, screenshotted since I couldn't easily copy/paste: https://imgur.com/N1ANEIb

Would love to better understand why the site is pulling in the Babel transpiler in production?

Edit: siblings know more than me, thank you siblings!

Re:Why React Re-Renders by AtlasBarfed on Tuesday August 16, 2022 @04:45PM (#32488673)
Now that is how you start a flame war in the most subtle way possible.
Re:Why React Re-Renders by rajangdavis on Tuesday August 16, 2022 @04:35PM (#32488539)
When I checked it was 46MB! Looking at the network tab, it seems to be making a bunch of extra requests for the same assets.

I know that Vercel/Next.js will lazily load in certain JS chunks but there seems to be some mechanism that is loading a ton of stuff up front. Edit: from other comments in this thread, it's the sandbox code, really crazy how much overhead that adds to the page!