Facing Frontend's Existential Crisis

Rate this content
Bookmark

The state of frontend development last couple years is in an odd place for the uninitiated web developer and expert alike. Server Components? Resumability? Hydration? Waterfalls? Islands? Why so much focus on water? And why are we even talking about this? In this talk, SolidJS creator Ryan Carniato explores the landscape of modern web development to understand how we got here and what these solutions really solve.

This talk has been presented at React Summit 2024, check out the latest edition of this React Conference.

FAQ

The web turning 30 signifies the rapid evolution of web development practices over the decades. Ryan Carniato highlighted that each decade brought dramatic changes, with the past decade being dominated by single-page applications.

The primary assets contributing to the size of web pages include HTML, CSS, and JavaScript. Among these, JavaScript is one of the most expensive assets per byte due to its parsing and execution time.

The 'uncanny valley' refers to the time between when a server-rendered page is visible and when it becomes interactive. This happens because server-rendered pages often require additional JavaScript for hydration, which can delay interactivity.

Islands architecture involves breaking up a web application into sections where some parts are server-rendered, and others are client-rendered. This can minimize the amount of JavaScript and data sent to the client, improving load performance.

Server components render on the server but communicate using a diffing format rather than HTML. This approach allows the use of React's features like context and async data handling without the issues of state-tearing that can occur with islands.

Resumability refers to serializing the state of a framework so that no hydration is needed on the client side. This can significantly reduce the execution cost and improve load performance.

Ryan mentioned that if attendees wanted to hear more about Solid, they should listen to Achille's talk later. His presentation was more focused on discussing broader trends in front-end technology.

Ryan Carniato believes the future of web frameworks is still evolving because there are ongoing innovations and explorations aimed at solving real problems. He emphasizes that every framework benefits from these advancements, and the best solutions may still be ahead.

Solid Start is a meta framework designed for builders, offering flexibility and performance for rendering on the server. It supports both single-page applications and server rendering, starting at a minimal size and allowing developers to add tools as needed.

Ryan Carniato's talk primarily focused on the changes in front-end technology over the past few years, with a specific emphasis on the challenges and solutions related to JavaScript and single-page applications.

Ryan Carniato
Ryan Carniato
37 min
14 Jun, 2024

Comments

Sign in or register to post your comment.
  • Haris Khan
    Haris Khan
    Schiphol
    Transcription is wrong, it's from create react app talk
Video Summary and Transcription
I'm honored to be here today. The past decade has been dominated by single-page apps. Loading JavaScript is about 35 times slower than images on low-end devices. Server rendering involves sending more JavaScript and HTML, increasing payload and effort. React was developed for complex apps, but business needs have pushed towards simpler websites. Metrics for testing frameworks include code execution costs, bundle size, and payload size. Islands, popularized by frameworks like Astro and Fresh, break up apps into sections for server rendering. React's solution is to use islands and communicate in a diffing format. Quik reduces code execution and size, eliminating double-serializing. Frameworks like Solid Start provide tools for server rendering in a lightweight package. WASM frameworks have improved in performance. Next.js partial pre-rendering and HTMX offer solutions for sites with less interactivity.

1. Introduction to Front-end Technology

Short description:

I'm honored to be here today. The past decade has been dominated by single-page apps. The tool size of web pages has grown, especially JavaScript, which is one of the most expensive assets per byte. Loading JavaScript byte for byte is about 35 times slower than images on low-end devices.

I'm incredibly honored to be here today. I did not expect to be opening a React conference right off the bat, got to say that. But yeah, I'm actually not talking specifically about Solid. If you want to hear more about Solid, listen to Achille's talk a little bit later.

Today, we are going to be talking a lot about front-end technology. I think probably it is safe to say it feels like a lot has been changing in the last couple years and it wasn't that long ago the web turned 30. So it might be a little bit too early for a midlife crisis, but it definitely feels like it.

The truth is the way we've developed on the web has changed pretty dramatically every decade that it has been around, and it is pretty fair to say that the past decade has been dominated largely by single-page apps. You can tell by all the React developers here today. But single-page apps redefined how we looked at building on the web. They gave us the ability to look at the web not just as a server client model but as an application, almost like mobile. We could build experiences that didn't require doing these full-page reloads and by relying on rendering in the browser, however, when the CEO of a company behind arguably the biggest React framework in the world makes a comment like this, people have got to go, you know, what's going on here?

It should give a little surprise that over time the tool size of web pages has grown. We've added more interactivity, more images, more styling, more of pretty much everything. We expect it to give the experiences that we come to get used to, right? I'm actually pretty happy that these graphs all exist. I didn't have to make any of these. This is from the web album. Great stuff. The size on our page comes in many forms, HTML, CSS, JavaScript. JavaScript is not the biggest thing on the page. It only usually makes up about a third on average. But it is what we are going to focus on a bit today, because it happens to be one of the most expensive assets per byte. I love that there are so many existing diagrams for this. This is from Addy Osmani's cost of JavaScript article from several years ago. It's a classic. If you've never read it, you should read it. The whole idea is he took a low-end device on a low-end network, and he kind of showed back then, I think it was 2018, that loading JavaScript byte for byte was about 35 times slower than images, just because of the parsing and execution time. This is on Moto G4 or something. I think they are still floating around today. This is from Alex Russell. He had this chart where he was showing that on the low-end side of devices, things haven't gone up the same way as others.

2. Challenges of Client vs Server Rendering

Short description:

When you have a client-rendered site, you are doing a round trip to the server right away. But server rendering also has its challenges, as it involves sending more JavaScript and HTML to hydrate the page. This increases payload and effort.

It's almost like going back in time eight years. Don't get me wrong, this might not be your customers, you might not need to worry about any of this, but it has kind of started this focus, I would say since around 2020, right? And the big part of this is that when you have a site that's client rendered, like a single-page app, you are doing a round trip again to the server right away. You send the HTML and you have the script tag that says load my JavaScript. Most of the time you're doing another round trip to the server, these waterfalls, which we will learn aren't a good thing, basically multiple before you even get to see the main content of the page.

So we thought, okay, let's server render it. You skip out that whole thing and see the content right away. But that's not the end of the story. These are all old diagrams. I'm just loving this. Just stick with me, I will be getting to a point at some point. But there's that time between when you see the page and when you can interact with it. They call it the uncanny valley. It's because when you server render a page, you actually end up sending more JavaScript generally, not less JavaScript. Kind of confusing but now you need to be able to hydrate the page and render the page. It's not only that you send more JavaScript, you actually send more HTML. Your payload actually gets bigger because now you have this lovely thing on your page. I'm not making fun of Next.js here. Every framework has this. The Next data blob, or the Svelte data blob, or Remix, or solid start, it doesn't matter. We all spit out this giant piece of data, so we send everything to the browser twice. Once is data, once is HTML. So yes, we see it right away, but now we've actually doubled our effort pretty much everywhere.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Suspense is a mechanism for orchestrating asynchronous state changes in JavaScript frameworks. It ensures async consistency in UIs and helps avoid trust erosion and inconsistencies. Suspense boundaries are used to hoist data fetching and create consistency zones based on the user interface. They can handle loading states of multiple resources and control state loading in applications. Suspense can be used for transitions, providing a smoother user experience and allowing prioritization of important content.
SOLIDify Your React Code
React Day Berlin 2023React Day Berlin 2023
11 min
SOLIDify Your React Code
Watch video: SOLIDify Your React Code
Clean code is easily understood, readable, changeable, extensible, and maintainable. SOLID principles enforce good practices for scalable and maintainable software. The Single Responsibility Principle (SRP) ensures that components have a single reason to change. The Open-Close Principle (OCP) allows components to be easily extended without modifying the underlying source code. The Liskov Substitution Principle (LSP) enables swapping child elements within a subtype component. The Interface Segregation Principle (ISP) states that components should only depend on the props they actually use.
SolidStart 1.0: Peeking Under the Hood
React Summit 2024React Summit 2024
30 min
SolidStart 1.0: Peeking Under the Hood
SolidStart is an efficient, unopinionated, and ergonomic full-stack framework that provides great defaults and flexibility. It includes features such as a bundler, a serializer, a server, and a router. The serializer, Seroval, enables streaming and real-time state synchronization between server and client. SolidStart offers powerful file routes, RPCs, and single-flight mutations. It is recommended for building UIs in full applications, Spark, single-page apps, and native apps.