The rise of multiframeworks paradigm in the frontend oss

Nicolas Toulemont - October 3rd 2022 - Edited
General

After a few years of heavy innovation and diversification in the frontend library space, I think we may start to see the beginning of a consolidation phase.

How we got here

Over the last 12 years, we've seen a lot of new general purpose UI rendering libraries / frameworks being built (Angular (2010), React (2013), Vuejs (2014), Svelte (2016), SolidJS (2021)).

The frontend ecosystem experimented a lot with each of these frameworks, re-inventing the wheel many times (how many framework specific routers, datepickers and selects/multi-selects were built in the last 12 years?). For a time, the tight coupling between UI frameworks and their surrounding ecosystem became the norm.

tightly coupled

A short while after, and maybe has a response to this tight coupling, the concept of headless ui got some traction.

At first this concept was very much applied within a framework specific context. It was much more about building framework specific components flexible enought to easily evolve over time rather than building cross-frameworks libraries. But it was a good reminder of the upsides of the separation of concerns in a UI building context, something that at the time was a bit forgotten about in favor tightly coupled components.

In parallel, the handling of the state of the component went throught a few iterations and innovations. Users felt the limitations of the basic state utilities built in the frameworks (useState, vuejs state management) particularly when it comes to handling "global" / "app" state for which the framework state utilities were not built to do (as they are focused on component state handling).

And the communities began to build solutions for these limitations, but with their core logic outside of rendering UI libraries, for example:

The combinaison of these two trends (headless ui and state handling outside of the UI framework) is the underlying force behind the emergence of a multiframework paradigm in the frontend ecosystem. They show that the ecosystems better understood the boundaries of their UI rendering frameworks, where it was good to lean on the framework and were it wasn't. It also shows that their is a whole different set of problems that are not framework specific, but are common to all UI frameworks.

In 2022, we've started to see quite a few "multiframeworks" libraries emerged and we are even starting to see a meta-framework go in that direction as well. Some of libraries (the whole Tan Stack for example) and framework (Remix) started coupled with one framework before going the multiframework route. Some other were built from the start with a multiframework goal Zagjs but it still came from the experience of building first for one framework (react) and then adding another one (vue) for the Chakra-UI library.

Design pattern wise, for these frontend libraries, the most common one I've seen adopted to serve these multiframework is, unsurprisingly, the adapter pattern.

core-adapter-framework

Now let's take a look at a few of these multiframework tools:

Multiframework at the library level

UI logic utility

Zagjs is a UI components library based on finite state machines supporting React, Vue and SolidJS. It was built by the creator of Chakra-UI, a React based UI kit that later built a VueJS version as well. Zagjs is a fairly new library (still in 0.X as of August 2022) was built with multiframework support in mind from the start and as a core philosophy in order to resolve the issue the maintainer faced building UI components for multiframework before. To quote them:

With the rise of design systems and component-driven development, there's an endless re-implementation of common component patterns (Tabs, Menu, Modal, etc.) in multiple frameworks. Most of these implementations seem to be fairly similar in spirit, the differences being around the reactivity and effects systems for the framework (e.g. useState, useEffect in React.js). Framework specific solutions tend to grow in complexity over time and often become hard to understand, debug, improve or test.

Interestingly, Zag is the first library (of many I hope) I've seen to support SolidJS from the start, a testament to SolidJS progress in the frontend ecosystem despite its quite recent release.

UI kits

Chakra UI is a React based UI kit that later built a Vue version as well. Interestingly, the source code from the two frameworks version is not shared (React, Vue). I would guess that this is mainly due to the history of the Chakra UI project, which first started as a React project and then later on, VueJS.

I very much see Zagjs as the logical next step in the evolution of the Chakra UI project, solving, I assume, a lot of the pain points the Chakra UI community faced rebuilding their UI kit for Vue after initially being focused on React.

Headless UI is a UI kit of "Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.". In the same vein as Chakra UI, this library doesn't implemented a shared core of logic with adapters but different packages for both React and Vue. Instead, it has a different implementation for each framework.

The Tan stack

tan stack

The "Tan Stack" is a great example for the rise of a multiframework approach (supporting pretty much every UI rendering framework except Angular). Built by Tanner Linsley, it's a small set of libraries (query, table, virtual, router) but originally around react that have (or are in the process of) migrated to a multiframework approach.

In many ways, I think that the Tan Stack is, with Zagjs, at the forefront of what the main libraries in the frontend ecosystem are going to be in the future. Built around a core of logic that can be adapted to multiple consumer frameworks, they bring a much more scalable solution to their problem space than framework specific libraries.

As of October the 3rd 2022, the main "Tan Stack" library query already has adapters for React, VueJS, SolidJS and is the process of having an angular and svelte adapter as well.

Multiframework at the full stack "meta framework" level

On the meta framework level, the Remix full stack framework doesn't market itself has a "React full stack framework" (unlike NextJS) but as a: "full stack web framework that lets you focus on the user interface and work back through web standards to deliver a fast, slick, and resilient user experience.".

They core opinion is that building on web standards (that are framework agnostic) solves most of the pain points of building a web application today. It's interesting to see that opinion emerge as a selling point in 2022, one could say that it is very revealing of the current state of frontend development practices.

First built with React as the view layer, the project heavily leverage the adapter architectural pattern, mainly to support various deployment target at the moment (August 2022). Despite being quite recent, it's seems that there is already some, community led, efforts to built support for others UI frameworks (Vue, maybe SolidJS).

Looking ahead

What could this mean ? First of all, I'm not sure of anything, I'm not even sure this emerging trend will continue in the future. But should it continue, we could expect the following:

From the same category