If you write a Rails application, you write it in Ruby. If you write a Django application, you write it in Python. Phoenix, Elixir. Lavavel, PHP. Rails gets a lot of flack for doing magic using meta-programming, and Elixir has macros, but all of the above stay within the boundaries of what can be done by the language.
- Once upon a time, nearly 20 years ago, the ECMA committee standardized E4X that enabled XML to be treated as a data type. This lost favor, got deprecated and archived. Years later what once was Facebook (now Meta) had a similar need and invented JSX. It differs from E4X in that it compiles into JS.
- One thing that ECMA TC39 has never standardized is type annotations. Undeterred, Microsoft did it anyway with TypeScript. It, too, compiles into JS.
The latest abuse of the bundler is by React Server Components (RSC). First demoed with express, it is now adopted by Next.js.
use server" and
"use strict"which also changes the meaning of the code that follows.
While JSX often compiles to JS, the Server React DOM APIs enable compilation to HTML. RSC goes a different way, and compiles into a stream of tagged JSON. This is all very transparent to you, but what it does enable is a different style of programming. One that many are comparing to PHP and even Rails:
It is not clear to me whether these comparisons are meant in a positive way, but I will say that from my perspective it is a very good thing.
From a fly.io perspective, RSC enabling an Update (Refetch) Sequence is very much of interest. We’ve always been especially shiny for frameworks that benefit from geographic distribution, like Elixir’s LiveView, Laravel’s Livewire and Ruby on Rail’s Hotwire. We want those kinds of frameworks to succeed, because the better they do, the more valuable we are. Now we can add React’s RSC to that list.
Dan Abramov gave a talk at RemixConf entitled React from Another Dimension:
In Dan’s talk he imagines an alternate universe in which React was first implemented in the late 90s on the server and still managed to converge to where it is today. During the talk he launches a Windows 95 emulator and runs Internet Explorer (specifically, IE6) with React. He even manages to get nine out of ten steps working using that operating system and browser combination.
The mind bending parts of this presentation are where he first utilizes
use server to implement a client side form action, and then later launches a client side alert from the server using
And he closes by saying that this requires new generation routers and new generation bundlers.