It's Time to De-Fragment the Web

Rate this content
Bookmark
Slides

Over the past few years, the number of web frameworks available to us has exploded. In some ways, the breadth of choice is a clear win for our ecosystem. However, for many of us, it also comes with harsh drawbacks: - Have you ever used a popular open-sourced component built for framework A, and wished it existed in framework B? What about a design system library? - Does your company have frontends built in different frameworks, and your web teams are frustrated about the wasted hours needed to achieve a consistent design system? - Does your team build SDKs for web frameworks, and must manually re-write them for each framework? The solution to all 3 of these problems exists today. To fully understand it, we must first examine today’s web frameworks, re-think what a component should look like, and introduce a new Intermediate Representation of our components. This is what we have done at Builder.io when we created Mitosis, and we’re excited to share it with everyone.

This talk has been presented at React Day Berlin 2022, check out the latest edition of this React Conference.

FAQ

Mitosis is an open-source project that allows developers to write components once and run them across various web frameworks. It aims to simplify the development process by generating compatible components for frameworks like React, Vue, Svelte, and more from a single source code.

Framework-agnostic component development is considered tedious because traditionally, developers need to rewrite the same component multiple times for different frameworks or use web components which have limitations, especially in server-side rendering contexts.

The main advantages of using Mitosis include reducing the need to rewrite components for different frameworks, facilitating easier maintenance, and supporting a wide range of web frameworks, thereby saving time and reducing potential errors.

Yes, Mitosis can handle server-side rendering. It generates framework-specific code that is optimized for server-side rendering across different platforms, addressing one of the common limitations of using standard web components.

Mitosis improves the development process by allowing companies to maintain a single source code for components that can be run on multiple frameworks. This reduces the complexity and resource overhead associated with maintaining parallel codebases for each framework, making it ideal for companies with diverse tech stacks.

As of the last update, most generators in Mitosis are in beta, with some in alpha. Despite this, many enterprise customers are successfully using SDKs built with Mitosis, and companies like Experian have started incorporating it into their UI design systems.

Contributors can join the Mitosis community on platforms like GitHub and Discord. The project is open for contributions ranging from adding new generators to improving existing features, with guides and support available for new contributors.

Sami Jaber
Sami Jaber
34 min
02 Dec, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk introduces Mitosis, an open source project that solves the problem of building framework agnostic components. It supports JSX and Svelte syntax and outputs human-readable code for various web frameworks. Mitosis is already being used by enterprise customers and can be easily integrated with React, Svelte, and other frameworks. It saves time, allows for easy handling of framework version migrations, and enables efficient unit and integration testing.
Available in Español: Es hora de desfragmentar la web

1. Introduction to Framework Agnostic Components

Short description:

Today, I will discuss the idea of framework agnostic components. Building these components can be tedious, and current solutions like writing them by hand or using web components have tradeoffs. That's why we've developed Mitosis, an open source project that solves this problem. I'll show you why building these components is tedious, why Mitosis is a good solution, and how it works better than expected.

Well, you guys have a lot of energy for a full day of talks. Thank you for sticking around for mine. Thank you to the React Day Berlin organizers for choosing my talk and for everyone else who's in the room today. I'm really, really excited about what I want to talk about, so let's just dive in.

What I'm going to be discussing today is the idea of framework agnostic components. Those to those who are unfamiliar with that idea is when you write a component that you want to render in different web frameworks. So a React app, a Quick app, a Svelte app, a Vue app. There are a lot of scenarios where you want to build such a component because of a business need or any other kind of need. Doing that today is really tedious. You effectively have one of two choices. You can either do it by hand, write that same component over and over by hand four, five, six times, which is obviously not great, or you can use web components, which is a standard that's been developed on top of web browsers. Both of those have tradeoffs that we at Builder we're unhappy with. This is why we've come up with a solution, which is Mitosis, an open source project that's already been available for a couple of years now, that solves this problem for us and hopefully for other people. So I'm going to try to convince you that building those components is tedious right now, and I'm going to try to convince you that Mitosis is a good solution for that. And towards the end, I'm going to try to really, really convince you that Mitosis works, because it is almost too crazy to work, but it does work better than you would expect.

2. Introduction to Sami Jaber and Buildr

Short description:

I'm Sami Jaber, a software engineer at Buildr and the primary contributor and maintainer of the Buildr.io SDKs. Buildr is a headless visual CMS that allows non-web developers to build web pages by dragging and dropping components. I also build the SDKs using Mitosis. Previously, I worked on Splash as a web developer.

Now, before we get into all of that, I just want to introduce myself briefly. My name is Sami Jaber, I'm a software engineer at Buildr. I'm the primary contributor and maintainer of the Buildr.io SDKs. So Buildr is a headless visual CMS, which means you can drag and drop your own components in a way that lets non-web developers build web pages, and what powers all of that is the SDKs, which need to be different for each web framework. And so I'm the contributor to those SDKs and I build them using Mitosis, which I'm also the primary contributor to. Before my time at Buildr, I was one of the web developers on Splash.

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

The Good, The Bad, and The Web Components
JSNation 2023JSNation 2023
29 min
The Good, The Bad, and The Web Components
Top Content
Web Components are a piece of reusable UI enabled by web standards and built into the web platform. They offer the potential for faster component initialization and less library overhead. Web Components can be created from scratch and utilized with existing component libraries. Shadow DOM and Declarative Shadow DOM provide benefits such as scoped CSS and server-rendered components. The tradeoff between not repeating oneself and achieving full server-side rendering support is discussed. User experience is deemed more important than developer experience.
Web Components, Lit and Santa 🎅
JSNation Live 2021JSNation Live 2021
28 min
Web Components, Lit and Santa 🎅
Web Components and the Lit library are introduced, highlighting their ability to create custom elements and replicate built-in components with different functionality. The use of semantic HTML and the benefits of web components in development are emphasized. The features of Lit, such as data binding and rendering, are discussed. The Santa Tracker is showcased as an example of web components being used in educational games. The compatibility of web components with other frameworks and their versatility in creating small widgets or large applications are highlighted.
Authoring HTML in a JavaScript World
React Summit US 2023React Summit US 2023
21 min
Authoring HTML in a JavaScript World
Watch video: Authoring HTML in a JavaScript World
This Talk by Tony Alicia focuses on authoring HTML in a JavaScript world. The speaker challenges developers to change their approach to building React components by starting with HTML first. By authoring HTML in a semantic way, readability and maintainability can be improved. Well-authored HTML provides better understanding of content and improves accessibility. It also has performance benefits by reducing DOM size. Investing time in HTML can save time and make applications more future-proof.
Immutable Web Apps
JSNation 2022JSNation 2022
20 min
Immutable Web Apps
Today's Talk discusses immutable web apps and their benefits, such as faster loading times and easy version tracking. The use of Universal Module Definition (UMD) style bundling allows for flexible dependency management and gradual upgrades. Tools like Webpack and Rollup provide ways to reference UMDs in bundles and automate dependency configuration. Arborist and YAML files help resolve dependency trees and handle conflicts, while the Orchard CLI tool automates dependency ordering. Internal and external dependencies can be initialized and managed effectively for optimal performance.
Web Components are awesome!
JSNation 2022JSNation 2022
10 min
Web Components are awesome!
Web components allow you to create your own HTML elements that can do anything you want, and they are supported by all modern browsers. Many companies, including YouTube and GitHub, use web components to enhance their websites. There are extensive tooling and libraries available for web component development. The Model Viewer Web Component enables the display of 3D models in Virtual and Augmented Reality without needing to know underlying technologies. Web components can be used with various frameworks and libraries, and there are resources available to help with compatibility.
Let's talk about Web Components
React Advanced Conference 2021React Advanced Conference 2021
32 min
Let's talk about Web Components
Web Components are a suite of technologies that allow you to create reusable HTML elements, combining the fun of React with regular HTML. Custom elements and the shadow DOM are key features of Web Components, allowing you to define new elements, encapsulate functionality and styles, and interact with a separate DOM. HTML templates serve as placeholders for content to be rendered later in custom components. Custom elements and HTML templates are cross-framework compatible and can be used in React, Angular, Vue, or any other framework.

Workshops on related topic

Web Components in Action
JSNation Live 2021JSNation Live 2021
184 min
Web Components in Action
Workshop
Joren Broekema
Alex Korzhikov
2 authors
The workshop extends JavaScript programming language knowledge, overviews general software design patterns. It is focused on Web Components standards and technologies built on top of them, like Lit-HTML and Lit-Element. We also practice writing Web Components both with native JavaScript and using Lit-Element. In the end we overview key tooling to develop an application - open-wc.