Elisa  Marks

Elisa Marks

1625459093

Million: A Less-than-1KB Virtual DOM Implementation

Introduction

<1kb virtual DOM - it’s fast!

Current Virtual DOM implementations are inadequate—Ranging from overcomplicated to abandoned, most are unusable without sacrificing raw performance and size. Million aims to fix this, providing a library-agnostic Virtual DOM to serve as the core for Javascript libraries.

Hello World Example

Below is an extremely simple implementation of a Hello World app using Million.

import { m, createElement, patch } from 'million';

// Initialize app
const app = createElement(m('div', { id: 'app' }, ['Hello World']));
document.body.appendChild(app);
// Patch content
patch(app, m('div', { id: 'app' }, ['Goodbye World']));

#javascript #react #web-development #webdev #dom

Million: A Less-than-1KB Virtual DOM Implementation