React vs HTMX - A Fascinating War

Theo - t3β€€gg
12 Apr 202422:23

Summary

TLDRThis video script delves into a comparative analysis of React, Solid, and HTMX, exploring their architectures and server-rendering capabilities. It highlights React's new server components and their role in the unified model for UI development. Solid is praised for its emphasis on primitives over abstractions and simplicity over ease of use, which positions it well in the JS framework landscape. HTMX is introduced as a server-centric approach that challenges the SPA norm, offering interactivity with minimal client-side scripting. The discussion invites viewers to consider the trade-offs of each framework and decide which approach best fits their project needs.

Takeaways

  • πŸ˜€ The script discusses a blog post that deep dives into comparing React, Solid, and HTMX, focusing on their rendering processes and server relationships.
  • πŸ€” It emphasizes the importance of understanding React Server Components (RSC) within the context of the new React architecture rather than in isolation.
  • πŸ” The author of the blog post argues that the term 'React Server Components' might not fully encapsulate the changes in React's architecture, suggesting a need for a better term.
  • πŸ—οΈ The new React architecture is described as a server-client model that allows components on the server side to access new computing environments and resources.
  • πŸ“ˆ Despite the benefits, the new React architecture may come with increased bundle size and tooling challenges, particularly with server components.
  • 🌟 Solid is highlighted for its focus on primitives over abstractions and explicitness over implicitness, aiming for simplicity over ease of use, which is beneficial at scale.
  • πŸš€ Solid's approach to server-side rendering is through server functions that leverage existing bundler features, allowing for RPC calls and streamlined server support.
  • πŸ”„ HTMX is introduced as a simple library that extends HTML with hypermedia attributes, reducing the need for client-side JavaScript and promoting a server-centric approach.
  • πŸ› οΈ HTMX challenges the traditional single-page application model by allowing sophisticated behaviors to be encoded directly into HTML, simplifying interactivity without extensive scripting.
  • πŸ’‘ The script ponders the future of these frameworks and libraries, suggesting that each has its strengths and is suited to different use cases, with no one-size-fits-all solution.
  • 🧐 The author invites viewers to consider which approach aligns best with their needs, whether it's the full-spectrum coverage of React, the client-side focus of Solid, or the server-centric simplicity of HTMX.

Q & A

  • What is the main topic of the blog post discussed in the video?

    -The main topic is a deep dive comparison of React, Solid, and HTMX in terms of their rendering process, architecture, and relationship with the server.

  • What does the author suggest is the biggest failure of the new React architecture?

    -The author suggests that the biggest failure is the lack of a term to describe the comprehensive changes in the new React architecture, not just the introduction of React Server Components (RSC).

  • What is the author's opinion on the term 'React Server Components'?

    -The author believes that 'React Server Components' might be a misnomer and that the new React architecture should be the focus, as RSC is just one part of it.

  • How does the author describe the new React architecture?

    -The author describes it as a unified model for UI development that brings both client and server ends under a single coherent paradigm, a true one-app architecture.

  • What are some potential pitfalls of the new React architecture mentioned in the video?

    -Some pitfalls include increased bundle size, issues with server resource access leading to waterfall issues, and the need for improved tooling and messaging.

  • What is the main focus of Solid according to the video?

    -Solid's main focus is on using primitives over abstractions, explicit over implicit, and simplicity over ease of use, especially as applications grow in complexity.

  • What is the significance of Solid's approach to reactivity?

    -Solid's approach to reactivity emphasizes simplicity and explicitness, which can lead to more sustainable and maintainable code at scale, even though it might be harder to adopt initially.

  • How does HTMX differ from traditional JavaScript frameworks?

    -HTMX extends HTML as hypermedia, encoding behaviors directly into HTML attributes, which is the opposite of JSX, where JavaScript writes the template.

  • What is the core goal of HTMX?

    -The core goal of HTMX is to enable server-centric web applications that can match most single-page apps in terms of interactivity and modern UX with little to no client-side scripting.

  • What are the limitations of HTMX compared to frameworks like React or Solid?

    -HTMX has lower interactivity ceilings and is not suitable for complex applications that require heavy client-side behaviors, such as 3D rendering or distributed systems.

  • What is the author's perspective on the future of these frameworks?

    -The author suggests that there is no clear winner and that different approaches have different trade-offs, benefiting different use cases, and that it's too early to predict which approach will prevail.

Outlines

00:00

πŸ€” Deep Dive into React, Solid, and HTMX

The paragraph discusses a blog post that compares React, Solid, and HTMX, focusing on their rendering processes and server relationships. It emphasizes the importance of understanding the new React architecture in the context of React Server Components (RSC). The author agrees with the notion that RSC should be seen as part of a broader architectural shift rather than an isolated feature. The paragraph also touches on the challenges of adopting new technologies within the existing React ecosystem and the potential for RSC to change the way developers think about UI development.

05:02

πŸ† Solid's Rise and the Quest for Simplicity

This paragraph highlights Solid's impact on the JavaScript front-end landscape in 2023, noting its win at the T3 Awards and the community's growing recognition of its ideas. The author discusses Solid's core principles, such as favoring primitives over abstractions and explicitness over implicitness, which contribute to its sustainability at scale. The paragraph also addresses the potential for Solid's reactivity model to influence other frameworks and the upcoming Solid 2.0 release, which promises a renewed reactivity implementation and the official Solid web framework.

10:03

🌐 Solid's Approach to Server Functions

The author explores Solid's strategy for server-side rendering and data fetching, which leverages existing React ecosystem primitives and emerging bundler features. Solid's server functions are likened to React's server actions, utilizing RPC calls for direct access to server resources. The paragraph also compares Solid's server functions to other data fetching and state management solutions, noting their potential to offer a comprehensive package that combines the best features of various technologies.

15:03

πŸ“š HTMX: Challenging the SPA Paradigm

This paragraph introduces HTMX as a simple library that extends HTML with hypermedia attributes, allowing for sophisticated behaviors to be encoded directly into HTML. HTMX challenges the mainstream single-page application (SPA) model by offering a server-centric approach that minimizes client-side scripting. The author discusses HTMX's potential to simplify web development by reducing the need for complex client-side frameworks and enabling advanced interactivity with minimal effort.

20:03

πŸ›€οΈ Crossing the Network Chasm with HTMX

The final paragraph delves into HTMX's philosophy and its implications for web development. It contrasts HTMX's server-centric approach with the traditional client-centric SPA model, highlighting how HTMX enables developers to build interactive web applications with less complexity. The author also discusses the limitations of HTMX and acknowledges that it may not be suitable for all types of applications, but appreciates its value in simplifying the development process for certain use cases.

Mindmap

Keywords

πŸ’‘React Server Components

React Server Components (RSC) are a new feature in React's architecture that allows components to be rendered on the server, leveraging server-side resources. This concept is integral to the video's theme as it discusses the evolution of React and its impact on UI development. The script mentions RSC as part of the 'new React architecture' and discusses its role in creating a unified model for UI development.

πŸ’‘Backwards Compatibility

Backwards compatibility refers to the ability of a system, product, or service to work with older versions or features without issues. In the context of the video, it is mentioned that the new features in React, including server components, maintain this compatibility, allowing developers to continue using older React code while also opting into new features.

πŸ’‘One-app Architecture

The one-app architecture is a concept where the same codebase runs both on the client and server sides, creating a seamless user experience. The script discusses this in relation to React's new architecture, suggesting that it represents a significant shift from traditional JavaScript-centric web frameworks and brings both ends under a single coherent paradigm.

πŸ’‘Waterfall Issues

In the script, waterfall issues refer to a series of dependent operations that must complete in sequence, which can cause delays and inefficiencies. The video discusses how these issues manifest differently when they occur on the server versus the client, and how the new React architecture addresses these concerns.

πŸ’‘Solid

Solid is a JavaScript library for building user interfaces, which emphasizes fine-grained reactivity and simplicity. The video script highlights Solid's influence in the JS front end landscape in 2023 and discusses its philosophy of 'primitives over abstractions' and 'explicit over implicit,' positioning it as a standout in the crowded JS framework space.

πŸ’‘Reactivity

Reactivity in the context of the video refers to the ability of a user interface to respond to state changes. Solid's approach to reactivity is highlighted, with the script mentioning its 2.0 update and a renewed reactivity implementation that emphasizes simplicity and explicitness over ease of use.

πŸ’‘HTMX

HTMX is a lightweight library that allows developers to add dynamic, interactive features to their web applications without writing much JavaScript. The video script discusses HTMX's approach to web development, which extends HTML with hypermedia attributes, positioning it as an alternative to JavaScript-heavy frameworks like React.

πŸ’‘Hypermedia

Hypermedia refers to the use of hypertext links to connect and navigate through different pieces of content. In the script, HTMX is described as encoding sophisticated behaviors directly into HTML as hypermedia attributes, which is a contrast to JSX and represents a server-centric approach to web development.

πŸ’‘Client-Centric

Client-centric refers to an approach where the client-side of an application is the primary focus, with the logic and interactivity primarily handled by the client. The script contrasts this with server-centric approaches, noting that React and Solid are client-centric but offer different ways to integrate server-side capabilities.

πŸ’‘Server Functions

Server functions, as mentioned in the script, are a feature in Solid that allow for server-side logic to be executed and are similar to server actions in React. They are part of Solid's strategy to bring server capabilities closer to the client-side without requiring a full server-rendered architecture.

πŸ’‘Virtual DOM

The Virtual DOM is a concept used in React where a lightweight in-memory representation of the UI is kept and updated, rather than the actual DOM. The script discusses the Virtual DOM in the context of React's rendering process and how it differs from Solid's approach, which doesn't require rerunning components on the client side for hydration.

Highlights

This blog post provides a deep dive comparing React, Solid, and HTMX, focusing on rendering, server interaction, and architectural differences.

React Server Components (RSCs) should be understood within the context of the new React architecture, not in isolation.

The new React architecture supports both old and new components, maintaining backward compatibility while introducing server-side capabilities.

Solid JS has gained attention for its fine-grained reactivity and simplicity, winning the 2023 web framework of the year.

Solid's approach focuses on primitives over abstractions, simplicity over ease of use, and explicitness over implicitness.

HTMX offers a server-centric approach, extending HTML with attributes to encode behaviors, reducing the need for client-side scripting.

HTMX gained significant popularity in 2023, becoming the second most starred JavaScript framework on GitHub.

HTMX simplifies development by allowing sophisticated behaviors directly in HTML, offering a different route to the one-app architecture.

The new React architecture presents a unified model for UI development, integrating server and client-side components under a single paradigm.

Solid's minimal bundle size and cheap hydration costs make it efficient, avoiding the need for extensive server-side rendering.

React's virtual DOM approach requires re-running components on the client for hydration, whereas Solid's state-based approach skips this step.

HTMX challenges the mainstream single-page application model by eliminating most client-side scripting in favor of server-rendered HTML.

HTMX's approach reduces complexity by avoiding extra dependencies, build steps, and advanced tooling, making it suitable for simpler applications.

React aims to cover the full spectrum of server-client interactions, Solid focuses on client-side reactivity with server capabilities, and HTMX emphasizes server-centric development.

The choice between React, Solid, and HTMX depends on specific use cases and the trade-offs each framework presents in terms of complexity, performance, and developer experience.

Transcripts

play00:00

react solid and HTM X this is an

play00:02

interesting blog post that I knew I had

play00:04

to talk about as soon as I saw it it's a

play00:06

pretty good Deep dive comparing react

play00:08

solid and HDMX in terms of how they

play00:10

render and work and relate to the server

play00:12

all things that we should concern

play00:13

ourselves with and think about more

play00:15

often so let's do just that react how

play00:18

far can components go saves it not a

play00:19

single day passes without someone on

play00:21

Twitter wondering what rsc's are really

play00:22

about I've made my own attempt at

play00:24

cracking it he has a blog post RSC is

play00:26

react server plus component arguing that

play00:28

react server components are best

play00:29

understood in the context of the new

play00:31

react architecture not in isolation this

play00:33

I fully fully agree with I didn't read

play00:36

the sentence before reading like

play00:37

skimming the post before yeah I already

play00:39

know I'm going to like this guy so the

play00:41

biggest failure of the new react stuff

play00:44

is that we don't have a term for all of

play00:46

the things that are changing with other

play00:48

Frameworks we have like vue3 where

play00:50

everything's different from vue2 or we

play00:52

have angular 2 which is different from

play00:54

angularjs the difference here is that

play00:57

everything being added still supports

play00:58

the old stuff and everything's fully

play01:00

backwards compatible so the idea of this

play01:02

version number change doesn't properly

play01:04

represent things we don't have a term

play01:06

for this movement because server

play01:08

components are just one piece of the new

play01:10

react architecture he refers to it as

play01:12

the new react architecture which is a

play01:14

very good way to put it because people

play01:16

try to learn server components the

play01:17

concept not server components and how

play01:20

they affect react's architecture so

play01:23

really important call out here I think

play01:24

it's important to not conflate react

play01:26

server components with the new way we do

play01:28

react and think about react architecture

play01:31

which again is entirely optional and opt

play01:33

in you can still use your old react code

play01:35

so let's see how he frames this cuz I'm

play01:36

already excited what we have here is not

play01:38

some new magic kind of components but a

play01:40

server client architecture that speaks

play01:42

react on both ends and grants components

play01:44

if placed on the server side direct

play01:46

access to new Computing environments and

play01:47

their resources this is one of the best

play01:50

summaries of what server components

play01:52

actually are okay already huge shout out

play01:54

to Boba Kang hopefully I pronounce your

play01:56

name correctly because this is

play01:58

phenomenal after another month of

play02:00

closely following the RSC discourse I

play02:02

still stand by it and personally I think

play02:04

react might be making mistakes by

play02:05

picking RSC as an umbrella term I

play02:08

promise I didn't pre-ad I skimmed to

play02:10

make sure it was what I thought it was I

play02:12

like this person a lot nonetheless I

play02:15

appreciate the new react architecture is

play02:17

a unified model for UI development that

play02:19

brings both ends under a single coherent

play02:21

Paradigm a true oneapp architecture this

play02:24

is a significant departure from most JS

play02:26

Centric web Frameworks including those

play02:27

built on top of react that provide

play02:29

various server sites features like

play02:30

server side props in next as well as

play02:32

loader and action in remix things like

play02:34

that it's doubtless that these things

play02:35

are useful but they fundamentally are

play02:37

external to the core UI application

play02:39

placed squarely on the client side

play02:41

speaking my language so hard when your

play02:44

mind is already separating server and

play02:46

client this strictly where you have

play02:48

these specific points that are inputs

play02:50

and outputs to the server the new model

play02:52

doesn't map to that because the new

play02:54

model is as he said a true onea

play02:56

architecture combined with composability

play02:58

of all of these Primitives instead of

play03:00

defining a loader that affects this URL

play03:03

you define a function that your

play03:04

component calls wherever the component

play03:06

is yeah I'm going to like this in

play03:08

practice the new react architecture

play03:10

isn't without pitfalls without careful

play03:12

planning react components with access to

play03:13

server resources still suffer from the

play03:15

same waterfall issues even though

play03:16

they're Now hidden from the network tab

play03:18

on the browser Dev tools locking this

play03:20

new architecture also comes at the cost

play03:21

of increased bundle size in server

play03:23

components support in tooling which is

play03:25

still at an early stage mostly Fair one

play03:27

important Point here is that waterfalls

play03:28

are fundamentally different when they

play03:30

happen on the server versus the client

play03:31

because when a waterfall happens on the

play03:32

client you have to redo a bunch of

play03:34

things like you have to reauthenticate

play03:36

the user you have to call an external

play03:38

server from the user's device you have

play03:40

to process things with JavaScript you

play03:41

have to do a lot of different things in

play03:44

order to make each of those waterfall

play03:46

requests rather than on the server where

play03:47

you've already authenticated the user

play03:49

you can just do all of those things and

play03:51

stream the results serers side

play03:52

waterfalls are so much less bad that

play03:54

it's almost not worth talking about as

play03:56

much anymore previously we ignored

play03:58

waterfalls which caused a bunch of

play03:59

problems when they happen on client now

play04:01

it's a little more valuable for us to

play04:03

ignore which is interesting that it's

play04:04

changed that much you want to know more

play04:06

about waterfalls and why I think these

play04:07

things I have 15 videos where I talk

play04:09

about it so just search server

play04:10

components or data with my name and

play04:12

you'll find it on YouTube that said I

play04:14

believe these are more Growing Pains

play04:15

rather than critical deficiencies

play04:16

inherent to the new model if react can

play04:18

successfully address these pain points

play04:20

via improved tooling and messaging 2024

play04:22

shall be the year where everything

play04:24

finally clicks for the mainstream

play04:25

audience versel Can you hire this person

play04:28

they understand this so well as I noted

play04:31

in an earlier blog post react versus the

play04:33

world react has a proud history of

play04:34

challenging the Contemporary norms and

play04:36

conventions of UI development including

play04:38

the ones it helped to popularize and

play04:40

winning over the world despite all the

play04:42

noise and confusion in the ongoing

play04:43

server component discourse react appears

play04:45

confident that it can repeat the history

play04:47

again relax it's react I don't know if

play04:49

I've read this blog post I am saving

play04:52

this for later for sure I I'm liking

play04:55

this a lot oh boy now we're just going

play04:57

straight in solid how far can primitive

play04:59

go if anyone asked me I'd say solid one

play05:01

the JS front end in 2023 not because it

play05:04

overtook reaction usage not even close

play05:06

but because it's ideas one saying solid

play05:08

won the JS front end in 2023 is really

play05:10

funny to me because I opened 2023 with

play05:12

the T3 Awards one of my most

play05:14

underappreciated things I we put a lot

play05:16

of work into this poor Mir spent so much

play05:18

time editing down this 4-Hour stream

play05:20

into a 2-hour video and adding nice

play05:21

overlays and such but the web framework

play05:23

of the year was of course solid I

play05:26

compared all of the different ones here

play05:28

but the winner oh I I even pulled chat

play05:30

to see if they could guess which one it

play05:31

would be and they actually successfully

play05:33

guessed it it was

play05:34

solid which uh I think is pretty cool at

play05:38

the time solid was really pushing these

play05:40

ideas and Ryan carniato in particular

play05:43

was becoming more and more involved in

play05:45

the greater web development discourse

play05:47

and yeah it was pretty clear to me that

play05:49

solid's ideas were doing well the solid

play05:51

framework and Community were going

play05:52

places no one had ever imagined before

play05:54

and it felt important to call that out

play05:56

and give them a literal award at my

play05:58

award show no we're not doing one this

play06:00

year some more fun things for the

play06:01

developer Awards coming soon anyways as

play06:03

the author was saying pretty much every

play06:05

framework but react has implemented

play06:07

signals in some form and even react

play06:09

adopted the language of reactivity to

play06:10

describe its optimizing compiler under

play06:12

development this is the uh reactivity

play06:15

compiler react forget blog post but this

play06:17

begs a question what's next for solid

play06:19

will the success of fine grain

play06:20

reactivity lead to the fall of solid

play06:22

which can no longer stand out from from

play06:23

the crowd solid's answer is no in 2024

play06:26

solid will reach 2.0 with a renewed

play06:28

reactivity implementation as well as

play06:30

solid start the official solid web

play06:31

framework which will reach 1.0 as I

play06:33

follow the ongoing development it's

play06:35

getting clearer to me that I like many

play06:36

others have been missing the point of

play06:38

solid the point of solid is not signals

play06:40

or fine grain reactivity that's more a

play06:41

happy accident the real point is about

play06:43

The Primitives over abstractions

play06:45

explicit over implicit in Simplicity

play06:47

over ease of use I take back what I said

play06:49

about versell Ryan you need to make sure

play06:51

this guy doesn't end up at versell

play06:53

because you need him anyways this is

play06:55

this is so well put specifically the

play06:57

idea of Simplicity over ease of use this

play06:59

is something I didn't realize I fight

play07:01

constantly but I absolutely fight

play07:03

constantly where I'm always looking for

play07:05

Simplicity and people pretend these two

play07:07

things are the same and they show me

play07:09

something that's easier that is less

play07:10

simple this is one of my favorite

play07:13

examples of what we're talking about

play07:14

here with Simplicity versus ease of use

play07:17

spelt solution here is objectively

play07:19

easier to use let count equal zero and

play07:21

now if you want to change count you set

play07:23

it to something else later on react

play07:24

solution is less easy to use because

play07:26

you're calling all these other things

play07:28

you're importing things you're doing all

play07:29

this stuff react solution here

play07:30

unintuitively is actually quite a bit

play07:33

simpler like significantly so because

play07:35

react solution is using JavaScript is

play07:38

Javascript it's not adding new things on

play07:40

top the same way spelt is using a

play07:42

compiler to change this so much so that

play07:45

spelt actually went in this Direction

play07:46

with their recent changes with runes if

play07:48

you look at spelt runes you'll realize

play07:50

oh these are actually quite a bit more

play07:52

complex than the previous solution

play07:54

because instead of let count equals zero

play07:55

it's let count equals dollar sign state

play07:57

zero this is less easy to use but the

play07:59

result is simpler because it's not

play08:01

compile step generating these things in

play08:03

a spelt file it's actually using

play08:06

Primitives that are reusable and

play08:07

composable across things and as they

play08:09

said here it doesn't even feel felt like

play08:12

but as they say here the reality is that

play08:14

as applications grow in complexity

play08:15

figuring out which values are reactive

play08:17

and which ones aren't can get tricky and

play08:19

the heris stics only work for let

play08:20

declarations at the top level of a

play08:22

component which can cause confusion so

play08:24

even though the other way was easier to

play08:27

use it becomes significantly less simple

play08:29

especially as your code base gets bigger

play08:31

and you have more and more complex

play08:32

things ease of use makes it easier to do

play08:35

a snippet for a sample but it doesn't

play08:37

help you solve hard problems over time

play08:39

Simplicity might be harder to adopt but

play08:42

it means these problems hurt you less

play08:43

over time which is why there are so many

play08:45

big react code bases that are getting

play08:47

bigger every day that are doing just

play08:48

fine that are shipping major updates

play08:50

without issues because react Primitives

play08:52

even the more complex to learn end up

play08:54

being simpler at scale so yeah this blog

play08:57

post is giving me realizations which is

play08:59

a really really good sign and the

play09:01

Simplicity over ease of use point is a

play09:02

huge one here this also fits with The

play09:04

Primitives over abstractions and

play09:05

explicit over implicit doing these

play09:06

things explicitly makes things more

play09:09

sustainable and that's how solid remains

play09:11

a standout to the crowded JS framework

play09:12

space where others often seek to attract

play09:15

developers with easy to use abstractions

play09:16

that feel magical I'm actually curious

play09:18

what he linked there for the feel

play09:20

magical good reference magical not magic

play09:22

there subtle line between something

play09:23

feeling magical and something feeling

play09:24

like magic we want spelt to feel magical

play09:26

want you to feel like a wizard when

play09:27

you're writing spelt code historically I

play09:29

think felt went too far into magic

play09:31

territory where it's not 100% clear why

play09:33

things work a certain way and that's

play09:34

something we're rectifying with spelt 5

play09:36

yeah really good reference in solid to

play09:39

is eyeing on solving the server side of

play09:41

the equation with a new set of

play09:42

Primitives albeit from a different angle

play09:44

instead of creating its own version of

play09:46

server component solid is betting on

play09:47

streamline support for Server functions

play09:49

solid's server function looks similar to

play09:51

server actions in react they're both

play09:53

marked with the US server directive and

play09:55

with a bundler help they get turned into

play09:56

RPC calls this is actually one of the

play09:58

interesting things I think Ryan's done a

play10:00

great job with is recognizing The

play10:02

Primitives that exist within the react

play10:04

ecosystem that aren't specific to react

play10:06

solid is the first popular jsx based

play10:08

framework that isn't react which is kind

play10:10

of crazy when you think about it that

play10:12

other Frameworks didn't take advantage

play10:13

of this open primitive standard that

play10:15

anyone could use they chose to which

play10:16

made it way easier for me to transition

play10:18

to solid from react and vice versa

play10:20

they're also taking advantage of new

play10:21

things that react is introducing like

play10:23

you server since this is now a bundler

play10:25

feature that many bundlers are

play10:26

implementing they can hijack the syntax

play10:28

and the feature use those same pipes

play10:30

that were built for react but instead

play10:32

using them for the things solid wants to

play10:33

do differently which is super cool to

play10:35

take these Concepts these Primitives

play10:37

these supported ecosystem pieces and use

play10:39

them to assemble something entirely

play10:41

different really cool stuff when

play10:42

combined with solid's official router

play10:44

and its data API which has action cache

play10:46

create async somewhere hybrid between

play10:49

what react's doing now and what remix

play10:51

did before solid server functions can

play10:53

offer pretty much everything that you'd

play10:54

want from a data fetching SLS server

play10:56

State Management Solution Direct access

play10:58

to server resources via flexible RPC

play11:00

interfaces with caching and Route level

play11:02

parallel fetching the best of relay

play11:03

tanet query trpc and remix all in a

play11:06

single package the fact that you're

play11:07

calling out relay suggests you're way

play11:09

deeper than almost anyone watching this

play11:10

video let me know in the comments if

play11:11

you've actually shipped relay because

play11:13

I'm convinced the only people who have

play11:14

are employees of meta or people with

play11:16

multiple phds so let me know in the

play11:18

comments also recall that a solid

play11:20

component is more like a setup function

play11:22

that runs once to wire up the reactivity

play11:24

graph then a render function that

play11:25

continually reruns the produce the

play11:27

latest UI I just talked about this a

play11:28

bunch in the video I did earlier today

play11:31

which hopefully is out before this

play11:32

talking about how the new Vue Vapor

play11:34

compiler Works comparing how these

play11:36

render strategies work so if you want a

play11:37

deep dive on this I'll link that video

play11:39

in the description this means that the

play11:41

potential gain for moving components to

play11:42

server is much smaller for solid than it

play11:44

is for react plus solid already has a

play11:47

minimal bundle size and its hydration

play11:49

cost is relatively cheap so it's

play11:51

understandable why solid doesn't

play11:52

consider server component to be a

play11:53

critical piece of its take on the onea

play11:55

architecture I'm trying to decide if I

play11:57

want to go deeper into the virtual Dom

play11:58

thing here cuz I just just talked about

play11:59

it so much but it's a different video

play12:01

can I need to repeat the context I'm

play12:02

going to repeat it I'm sorry I I know I

play12:04

just said watch my other video but I'm

play12:06

going to dive a little bit into this

play12:07

because it's important react has a

play12:08

virtual Dom which is a full

play12:10

representation of all of your components

play12:12

that exists in your memory in JavaScript

play12:14

and when you make a change it reenders

play12:16

all of those things in the virtual Dom

play12:18

to compare the difference before and

play12:20

after to see if it's different and if it

play12:21

is then it updates the web page

play12:23

accordingly but in order for those

play12:25

components to know which element they're

play12:26

bound to on the page it has to run in

play12:28

your browser so even if you generate an

play12:30

HTML page on the server using react and

play12:33

using the virtual Dom over there once it

play12:35

shows up in your browser in order for

play12:37

react to run and update things it

play12:39

doesn't know which component goes where

play12:41

until it's run all your components again

play12:42

which means react has to rerun the same

play12:44

client side JavaScript code in order to

play12:47

hydrate to bind those components to the

play12:49

right places in the HTML and that takes

play12:51

enough compute that whole Frameworks

play12:53

have been built arguing about it quick

play12:55

exists exclusively because of that

play12:57

hydration problem the fact that you have

play12:58

to rerun the same JavaScript on the

play13:00

client in order to match it up with the

play13:02

HTML solid skips that because as I

play13:04

mentioned in the view video that I

play13:05

referenced earlier solid doesn't create

play13:07

a tree of components it creates a tree

play13:09

of state and every time you use a

play13:11

stateful element in different places it

play13:13

creates a tree of updates for all of

play13:15

those things which means as long as it

play13:17

knows where those stateful bindings are

play13:18

you don't have to rerun your components

play13:21

you just have those values and when they

play13:22

change they change that means you don't

play13:23

have to ship as much JavaScript it means

play13:25

you don't have to run as much JavaScript

play13:26

and it means a lot of the issues that

play13:27

would make you want to server render

play13:29

aren't as present but it's still very

play13:30

nice to get good HTML down from your

play13:32

server so there's a balance here for

play13:33

sure notably solid's approach does not

play13:35

require any radical shift in mental

play13:37

model it still feels very much client

play13:39

Centric but with additional Primitives

play13:40

that can be combined to bring the server

play13:42

closer it's modular incremental familiar

play13:44

and practical potentially a winning

play13:46

combination I agree and I'm very excited

play13:48

to see where it goes speaking of where

play13:49

things are going let's go to HTM X and

play13:52

see how far hyper media goes with it

play13:54

2023 saw an unexpected entrance to the

play13:56

JS framework War HTM x a simple Library

play13:59

consisting only of a single JS file came

play14:01

to the scene seemingly out of nowhere

play14:03

and took the web developer Community by

play14:05

storm adding 15,000 new GitHub Stars

play14:08

HDMX earned the second place in the 2023

play14:10

JavaScript Rising Stars for the

play14:12

front-end framework category which puts

play14:14

them just behind react and pretty close

play14:16

in terms of new stars gained that year

play14:18

when you think about it that's pretty

play14:19

nuts JavaScript framework for people who

play14:21

hate JavaScript is number two for most

play14:24

stars in the year while hmx is not a new

play14:26

library in fact it came out in late 2020

play14:28

and its predecessor by the same author

play14:30

intercooler reached 1.0 back in 2016 its

play14:32

increased awareness and adoption means

play14:34

that 2024 will be the first year for HTM

play14:36

X to really shine and also its

play14:38

robustness to be tested HTM X presents

play14:41

an approach that is fundamentally at

play14:42

odds with what has been the mainstream

play14:44

for over a decade in this case a single

play14:47

page application entirely controlled by

play14:49

a react likee JavaScript framework

play14:50

directly manipulating Dom and exchanging

play14:52

data with mostly Json apis instead HTM X

play14:55

extends HTML as hyper media with HTM X

play14:58

we can encode sophisticated behaviors

play15:00

directly into HTML as attributes this is

play15:03

the exact opposite of jsx which is an

play15:05

XML like syntax extension to JavaScript

play15:07

itself for templating purposes it lets

play15:09

the JavaScript write the template rather

play15:10

than the HTML write the behaviors

play15:13

previously in like the OG world of like

play15:15

the jQuery days your HTML was your

play15:17

template and your JavaScript was your

play15:19

logic your update layer and you would

play15:21

start with some HTML that you wrote in

play15:22

HTML file and then the JavaScript would

play15:24

make changes as needed jsx was what if

play15:27

we just put the template in the HTML in

play15:29

the JS HTM X is what if we put the logic

play15:31

in the things that change in the HTML an

play15:33

HTM X app is server Centric like the web

play15:35

one dayss but it's able to match most

play15:37

single page apps in its ability to

play15:39

support Advanced interactivity and

play15:41

modern ux all with little to no client

play15:43

side scripting very good points and that

play15:45

is largely its goal what's particularly

play15:47

intriguing to me is that HTM X shows us

play15:49

a different route to the one app

play15:51

architecture by the way of killing the

play15:53

client side entirely it's important to

play15:55

note that HDMX is not a 100% solution it

play15:57

shouldn't be controversial to state that

play15:59

interactivity ceilings are much lower

play16:01

for HDMX than something like reactor

play16:03

solid I hate that this is controversial

play16:05

cuz I've gotten in trouble for saying

play16:06

this even though the HDMX team agrees in

play16:08

an old world and by old I mean when I

play16:10

worked at twitch a few years ago back in

play16:12

in front we're pretty separate and we

play16:13

had a thing in between that was almost

play16:15

the translation layer between the two

play16:16

for us it was graphql this was a way

play16:18

that we could make rules and agreements

play16:20

where the back end could go do its thing

play16:21

the front end could do its thing it

play16:22

would all come

play16:24

together something that started to

play16:25

happen is we saw more and more react

play16:27

devs realizing that they could benefit

play16:29

from running some things on the server

play16:31

maybe they don't want to manage the

play16:32

whole database themselves but they want

play16:33

to render their page on the server maybe

play16:35

they need an API endpoint quickly and

play16:37

they don't want to wait for the backend

play16:38

team to do it maybe they need to hit

play16:39

three different things at once once

play16:40

you're authenticated and massage that

play16:42

into the right shape for the data maybe

play16:43

they just want to do everything quick

play16:45

what nextjs enabled is for this line

play16:47

between the back end and the front end

play16:49

to be crossed by react previously there

play16:51

was a hard wall between these things

play16:53

that you would Bridge with another tool

play16:54

like graphql or even just Json apis with

play16:57

nextjs with mix with the stuff that

play17:00

we're talking about with solid and solid

play17:01

start with all these other tools and

play17:02

solutions react now has the option to go

play17:05

towards the server some amount this is

play17:07

great if you don't need to make a really

play17:09

complex back end if you were building a

play17:11

Twitter clone you don't need to reinvent

play17:13

the data layer you don't need to do

play17:15

really powerful optimized things there

play17:17

you can throw it on something like

play17:18

Planet scale attach it and hook it up

play17:20

via versel serve it via next and you're

play17:23

good and done is it as optimal as

play17:24

somebody writing a quality rust or go

play17:27

backend that's autoscaled with

play17:28

kubernetes

play17:29

no but it's pretty damn close and it's

play17:31

good enough for a lot of developers that

play17:33

exist on this side that want to do

play17:35

enough on the other side and they'll

play17:36

fill out the gaps with sasses like as I

play17:38

just said versel Planet scale clerk up

play17:40

stash axium all the things that I talk

play17:42

about sponsored by Etc here the magic of

play17:44

next in these new patterns is how much

play17:45

further we can get over the line here

play17:47

without having to call on a backend

play17:49

person or team to do that eventually you

play17:52

might want to move off of these sasses

play17:53

and hire a backend Dev or a team of

play17:55

backend devs to build this site for you

play17:57

but you shouldn't have to hire a backend

play17:59

Dev just to deploy your web app and have

play18:01

apis this is where I think HTM X is

play18:03

really interesting because if you're a

play18:05

backend developer and you want to make a

play18:07

Twitter clone previously your options

play18:08

were either to learn something like

play18:10

react so you could have good client side

play18:12

behaviors or don't and every time you do

play18:14

anything the whole page has to refresh

play18:16

when I make a new tweet I don't see it

play18:17

until the page reloads and then I lose

play18:19

whatever tweets were below it building

play18:21

something like Twitter entirely on the

play18:23

back end where you're just shipping HTML

play18:24

would be a terrible experience but in

play18:26

order to have a better experience on the

play18:27

client you would have to adopt react the

play18:30

same way in the past in order to have a

play18:31

backend for your react code that fetch

play18:34

the right data you would need go or node

play18:36

or any other set of Technologies as well

play18:38

as an API layer like graphql next lets

play18:41

you skip that if you don't need those

play18:43

details you just need the capability and

play18:46

with HTM X you can do a lot more of the

play18:48

client side stuff than you could

play18:50

previously if you want to have a tweet

play18:52

show up right below it once you post it

play18:53

without having to reload the page HTM X

play18:55

gives that to you if you want to have a

play18:57

search field that you don't have to

play18:58

reload the whole page when you change

play18:59

the inputs HTM X gives that to you a lot

play19:01

of the core behaviors that previously

play19:03

required you to opt into a JavaScript

play19:04

framework no longer do if you want to

play19:06

build a heavy canvas app or 3D rendering

play19:08

or a super interactive UI or figma HTM X

play19:11

is not going to help you at all the same

play19:13

way if I wanted to build a distributed

play19:14

system next isn't going to help me at

play19:16

all but if I'm not trying to build a

play19:17

distributed system I'm trying to build a

play19:19

web app next means I can skip the

play19:20

backend team if I'm not trying to build

play19:22

figma I'm trying to build Twitter HTM X

play19:24

lets me skip the front end team that's

play19:26

the value of HTM X it's not that it can

play19:28

do everything react can do is that if I

play19:31

only need to do this part of what react

play19:32

can do I don't need to use react anymore

play19:35

and that's a huge win but part of this

play19:36

win is acknowledging the chunk here of

play19:38

things HTM X cannot and will not help

play19:40

with because HTM X does not do this area

play19:43

it cannot do this area and it's not

play19:45

interested in doing this area and it

play19:46

shouldn't be the same way that next

play19:48

shouldn't be interested in competing

play19:49

with kubernetes check out my truth about

play19:51

htx video if you want a much longer rant

play19:52

about this yeah I got in trouble for

play19:54

that take I hope this author doesn't

play19:56

because they are correct the same way I

play19:58

was correct and as they say here even

play20:00

though it only gets you 80% of the way

play20:01

there it gets you there with radically

play20:03

less complexity no extra dependencies no

play20:05

more build steps no more advanced

play20:06

tooling now Rewritten and rust no

play20:08

complicated State Management no double

play20:10

data problems no hydration mismatches

play20:12

just write your HTTP server and return

play20:14

HTML in a way htx is not a solution but

play20:17

a question what are you really building

play20:19

does it really need more than HTM X

play20:21

which way to cross though most all web

play20:23

Frameworks aim to bridge the network

play20:25

Chasm I'm learning that this Chasm

play20:27

cannot be closed it can only be crossed

play20:29

so which way do you want to cross it

play20:30

react solid and HDMX all present

play20:32

distinct answers here with react we see

play20:34

an attempt to cover the full spectrum at

play20:36

once within the same component model

play20:38

with solid we see a focus on the client

play20:40

side with New Primitives to bring the

play20:41

server closer to it and with HTM X we

play20:43

see a good old server Centric approach

play20:45

but with a Twist that is supercharged

play20:47

hyper media maybe too early to predict

play20:48

which way will wi out maybe such a

play20:50

prediction is mere nonsense there is no

play20:51

Silver Bullet remember different

play20:53

approaches with different trade-offs

play20:54

will benefit different use cases

play20:56

differently nonetheless I believe that

play20:57

react solid

play21:58

of this video because this post is

play22:00

actually one of the best I've read ever

play22:02

especially for a video thank you for

play22:04

this awesome blog post and for everyone

play22:06

watching which horse are you betting on

play22:08

do you think that solid's focus on

play22:10

client is the win do you think HTM X

play22:11

going back to the server is the best

play22:13

call or do you think that the weird

play22:14

chaotic react compositional hybrid

play22:16

approach has the Merit that we all seem

play22:18

to love let me know in the comments and

play22:20

I'll see you guys next time peace NS

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
React FrameworkSolid ReactivityHTMX HypermediaWeb DevelopmentUI ArchitectureServer ComponentsClient RenderingJavaScript TrendsFrontend InnovationBackend Integration